<?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>in field assignment</description>
        <expected-problems>1</expected-problems>
        <code><![CDATA[
public class Foo {
    private boolean foo = (isFoo() == true);
    boolean isFoo() {return foo;}
}
        ]]></code>
    </test-code>

    <test-code>
        <description>in method body</description>
        <expected-problems>1</expected-problems>
        <code><![CDATA[
public class Foo {
    void foo() {
        boolean bar = (new String().length() >2) == false;
    }
}
        ]]></code>
    </test-code>

    <test-code>
        <description>ok</description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
public class Foo {
    boolean bar = true;
}
        ]]></code>
    </test-code>

    <test-code>
        <description>two cases in an &amp;&amp; expression</description>
        <expected-problems>2</expected-problems>
        <code><![CDATA[
public class Foo {
    void bar() {
        if (getFoo() == false && isBar() == true) {}
    }
}
        ]]></code>
    </test-code>

    <test-code>
        <description>simple use of BooleanLiteral, should not be flagged</description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
public class Foo {
    void bar() {
        if (true) {}
        if (false) {}
    }
}
        ]]></code>
    </test-code>
</test-data>
