<?xml version="1.0" encoding="UTF-8"?>
<test-data>
    <code-fragment id="complex-condition">
        <![CDATA[
	public class Example {
	    public int fn1(int a, int b, int c) {
	    	if (a == 0 || (b !=0 && c > 0)) {
	    	    return 1;
	    	}
	    	return 0;
	    }

	    public int fn2(int a, int b, int c) {
	    	return (a == 0 || b != 0 && c > 0) ? 1 : 0;
	    }
	}
		]]>
    </code-fragment>
    <test-code>
        <description>complex conditional expression in if condition</description>
        <expected-problems>2</expected-problems>
        <expected-linenumbers>3,10</expected-linenumbers>                                                                             0    0      ˘                                          0      /expected-linenumbers>
        <code-ref id="complex-condition"/>
    </test-code>

    <!-- ====================================================================== -->

    <code-fragment id="extract-condition-as-variable">
        <![CDATA[
	public class Example {
	    public int fn3(int a, int b, int c) {
	    	boolean flag = (a == 0 || b != 0 && c > 0);
	    	return flag ? 1 : 0;
	    }
	}
		]]>
    </code-fragment>
    <test-code>
        <description>complex conditional expression extracted as variable</description>
        <expected-problems>0</expected-problems>
        <code-ref id="extract-condition-as-variable"/>
    </test-code>

    <!-- ====================================================================== -->

    <code-fragment id="simple-condition">
        <![CDATA[
	public class Example {
	    public int fn() {
	    	List<Integer> ids = new ArrayList<>();
	    	if (ids.size() > 0) {

	    	}
	    }
	}
		]]>
    </code-fragment>
    <test-code>
        <description>simple conditional expression</description>
        <expected-problems>0</expected-problems>
        <code-ref id="simple-condition"/>
    </test-code>
</test-data>