<?xml version="1.0" encoding="UTF-8"?>
<test-data
    xmlns="http://pmd.sourceforge.net/rule-tests"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://pmd.sourceforge.net/rule-tests http://pmd.sourceforge.net/rule-tests_1_0_0.xsd">

    <test-code>
        <description>all is well</description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
public class Foo {
    public Foo(final Integer finalMethodParameter, Integer methodParameter) { }
}
        ]]></code>
    </test-code>

    <test-code>
        <description>default is camel case</description>
        <expected-problems>2</expected-problems>
        <expected-messages>
            <message>The final method parameter name 'FINAL_METHOD_PARAMETER' doesn't match '[a-z][a-zA-Z0-9]*'</message>
            <message>The method parameter name 'METHOD_PARAMETER' doesn't match '[a-z][a-zA-Z0-9]*'</message>
        </expected-messages>
        <code><![CDATA[
public class Foo {
    public Foo(final Integer FINAL_METHOD_PARAMETER, Integer METHOD_PARAMETER) { }
}
        ]]></code>
    </test-code>

    <test-code>
        <description>custom final method parameter pattern</description>
        <rule-property name="finalMethodParameterPattern">[a-zA-Z0-9_]+</rule-property>
        <expected-problems>1</expected-problems>
        <expected-messages>
            <message>The method parameter name 'METHOD_PARAMETER' doesn't match '[a-z][a-zA-Z0-9]*'</message>
        </expected-messages>
        <code><![CDATA[
public class Foo {
    public Foo(final Integer FINAL_METHOD_PARAMETER, Integer METHOD_PARAMETER) { }
}
        ]]></code>
    </test-code>

    <test-code>
        <description>custom method parameter pattern</description>
        <rule-property name="methodParameterPattern">[a-zA-Z0-9_]+</rule-property>
        <expected-problems>1</expected-problems>
        <expected-messages>
            <message>The final method parameter name 'FINAL_METHOD_PARAMETER' doesn't match '[a-z][a-zA-Z0-9]*'</message>
        </expected-messages>
        <code><![CDATA[
public class Foo {
    public Foo(final Integer FINAL_METHOD_PARAMETER, Integer METHOD_PARAMETER) { }
}
        ]]></code>
    </test-code>

    <test-code>
        <description>ignores null parameter names</description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
public with sharing class MyException extends Exception { }
        ]]></code>
    </test-code>
</test-data>
