<?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>No issues here</description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
import other.exceptions.SecurityException;
import yet.an.other.one.NoSuchMethodException;

public class MyClass {

    public void method() {
      // no args, no violation
    }

    public void otherMethod(String arg1, String arg2) {
      // less than 2, should be ok
    }

    public void otherMethod(String arg1, String arg2, int arg3) {
      // less than 2 Strings, should be ok
    }

    public void yetAnOtherOneWithException(String arg1,int arg2) throws SecurityException, NoSuchMethodException {
      System.loadLibrary("nativelib");
    }
}
        ]]></code>
    </test-code>

    <test-code>
        <description>Public method with 4 String parameters</description>
        <expected-problems>1</expected-problems>
        <expected-linenumbers>2</expected-linenumbers>
        <code><![CDATA[
public class MyClass {
    public void connect(String username,
        String pssd,
        String databaseName,
        String databaseAdress)
        // Instead of those parameters object
        // would ensure a cleaner API and permit
        // to add extra data transparently (no code change):
        // void connect(UserData data);
        {
        }
}
        ]]></code>
    </test-code>

    <test-code>
        <description>non-public methods should not have findings</description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
public class MyClass {
    protected void connectProtected(String username,
        String pssd,
        String databaseName,
        String databaseAdress)
    {
    }
    void connectPackagePrivate(String username,
        String pssd,
        String databaseName,
        String databaseAdress)
    {
    }
    private void connectPrivate(String username,
        String pssd,
        String databaseName,
        String databaseAdress)
    {
    }
}
        ]]></code>
    </test-code>

    <test-code>
        <description>String[] should not be treated as String</description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
public class MyClass {
    public void connectProtected(String username,
        String[] pssd,
        String databaseName,
        String databaseAdress)
    {
    }
}
        ]]></code>
    </test-code>
</test-data>
