<?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><![CDATA[
Simple violation
     ]]></description>
        <expected-problems>1</expected-problems>
        <code><![CDATA[
public class Foo {
	private Foo() { }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
ok, class is final
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
public final class Foo {
	private Foo() { }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
One public constructor, not required to be final
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
public class Foo {
	private Foo() { }

	public Foo(String param) { }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
Ok, subclass using the private constructor
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
public class Foo {
    private Foo() { }

    public static class Bar extends Foo {
        public Bar() { }
    }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
Ok, subclass using the private constructor of another subclass
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
public class Foo {
    public Foo() { }

    public static class Bar {
        private Bar() { }
    }

    public static class Barbie extends Bar {
        public Barbie() { }
    }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
Ok, two classes 
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
public class Foo {
    private Foo() { }
}
public class Bar extends Foo {
    public Bar() { }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
One protected constructor, not required to be final
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
class ClassWithOnlyPrivateConstructorsShouldBeFinal {
    private String string;
    
    protected ClassWithOnlyPrivateConstructorsShouldBeFinal(final Object object) {
        this(object.toString());
    }
    
    private ClassWithOnlyPrivateConstructorsShouldBeFinal(final String string) {
        super();
        
        setString(string);
    }
    
    public final void setString(final String string) {
        this.string = string;
    }
    
    public String getString() {
        return string;
    }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
One package private constructor, not required to be final
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
class ClassWithOnlyPrivateConstructorsShouldBeFinal {
    private String string;
    
    ClassWithOnlyPrivateConstructorsShouldBeFinal(final Object object) {
        this(object.toString());
    }
    
    private ClassWithOnlyPrivateConstructorsShouldBeFinal(final String string) {
        super();
        
        setString(string);
    }
    
    public final void setString(final String string) {
        this.string = string;
    }
    
    public String getString() {
        return string;
    }
}
     ]]></code>
    </test-code>
</test-data>
