<?xml version="1.0" encoding="UTF-8"?>
<test-data>
    <test-code>
        <description><![CDATA[
private String, no accessor
     ]]></description>
        <expected-problems>1</expected-problems>
        <code><![CDATA[
public class Foo {
 private String foo;
 private String bar = foo;
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
private static String
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
public class Foo {
 private static String foo;
 private String bar = Foo.foo;
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
private transient String
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
public class Foo {
 private transient String foo;
 private String bar = Foo.foo;
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
getter, no setter
     ]]></description>
        <expected-problems>1</expected-problems>
        <code><![CDATA[
public class Foo {
 private String foo;
 private String bar = Foo.foo;
 public String getFoo() {return foo;}
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
setter, no getter
     ]]></description>
        <expected-problems>1</expected-problems>
        <code><![CDATA[
public class Foo {
 private String foo;
 private String bar = Foo.foo;
 public void setFoo(Foo foo) {this.foo = foo;}
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
both accessors, yay!
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
public class Foo {
 private String foo;
 private String bar = Foo.foo;
 public void setFoo(Foo foo) {this.foo = foo;}
 public String getFoo() {return foo;}
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
setFoo and isFoo is OK for booleans
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
public class Foo {
 private boolean foo;
 public void setFoo(boolean foo) {this.foo = foo;}
 public boolean isFoo() {return foo;}
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
setFoo and isFoo is not OK for Strings
     ]]></description>
        <expected-problems>1</expected-problems>
        <code><![CDATA[
public class Foo {
 private String foo;
 public void setFoo(String foo) {this.foo = foo;}
 public String isFoo() {return foo;}
}
     ]]></code>
    </test-code>
    <code-fragment id="prefix"><![CDATA[
public class Foo {
 private String m_foo;
 public void setFoo(String foo) {m_foo = foo;}
 public String getFoo() {return m_foo;}
}
     ]]></code-fragment>
    <test-code>
        <description><![CDATA[
prefix is off by default
     ]]></description>
        <expected-problems>1</expected-problems>
        <code-ref id="prefix"/>
    </test-code>
    <test-code>
        <description><![CDATA[
valid prefix
     ]]></description>
        <rule-property name="prefix">m_</rule-property>
        <expected-problems>0</expected-problems>
        <code-ref id="prefix"/>
    </test-code>
    <test-code>
        <description><![CDATA[
invalid prefix
     ]]></description>
        <rule-property name="prefix">xxxxxx</rule-property>
        <expected-problems>1</expected-problems>
        <code-ref id="prefix"/>
    </test-code>
    <test-code>
        <description><![CDATA[
interface
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
public interface Foo {
 public String foo;
 public String bar = foo;
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
@SuppressWarnings("serial")
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
@SuppressWarnings("serial")
public class Foo {
 private String foo;
 private String bar = Foo.foo;
 public void setFoo(Foo foo) {this.foo = foo;}
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
ClassCastException on generic method
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
public abstract class List<A> implements Iterable<A> {
  public static <A> F<List<A>, Boolean> isEmpty() {
    return null;
  }
}
     ]]></code>
    </test-code>
    <test-code>
        <description>#881 private final without setter is flagged</description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
public class Foo {
    private final String bar = "BAR";
    public String getBar() { return bar; }

    private String baz;
    public void setBaz(String b) { baz = b; }
    public String getBaz() { return baz; }
}
        ]]></code>
    </test-code>
</test-data>
