<?xml version="1.0" encoding="UTF-8"?>
<test-data>
    <test-code>
        <description><![CDATA[
ok
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
public class Foo {
 void bar(int b) {
  for (int i=0;i<10;i++) { 
  	throw new Exception();
  }
 }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
DD anomaly
     ]]></description>
        <expected-problems>1</expected-problems>
        <code><![CDATA[
public class Foo {
 void bar() {
  int i=0;
  i=1;
  if (i==2) {}
 }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
DU anomaly
     ]]></description>
        <expected-problems>1</expected-problems>
        <code><![CDATA[
public class Foo {
 void bar() {
  int i=0;
 }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
UR anomaly
     ]]></description>
        <expected-problems>1</expected-problems>
        <code><![CDATA[
public class Foo {
 void bar() {
  int i;
  if (i == 0) {}
 }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
more komplex anomalysis
     ]]></description>
        <expected-problems>4</expected-problems>
        <code><![CDATA[
public class Foo {
 void bar(int i) {
  int j = 0;
  int z = 0;
  if (i < 10) {
   j = i;	 
  }
 }
}
     ]]></code>
    </test-code>

    <test-code>
        <description>#1393 PMD hanging during DataflowAnomalyAnalysis</description>
        <!-- Note: due to https://sourceforge.net/p/pmd/bugs/1383/ the 6 problems are false positives!  -->
        <expected-problems>6</expected-problems>
        <code><![CDATA[
public class LoopTest {
    public static void main(String[] args) {
        int[] a = {1,2,3};
        int[] b = {4,5,6};
        int[] c = {7,8,9};
        for (int i : a) {
            if (i == 0) {
                break;
            } else {
                boolean fail = false;
                for (int j : b) {
                    boolean match = false;
                    for (int k : c) {
                        if (k == 42) {
                            match = true;
                        }
                    }
                    if (!match) {
                        fail = true;
                    }
                }
            }
        }
    }
}
        ]]></code>
    </test-code>
</test-data>
