<?xml version="1.0" encoding="UTF-8"?>
<test-data>
    <test-code>
        <description>ok</description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
public class Foo {
 public static void bar() {
  if (true) {List buz = new ArrayList();}
 }
}
     ]]></code>
    </test-code>
    <test-code>
        <description>fail, with minimum</description>
        <rule-property name="minimum">1.0</rule-property>
        <expected-problems>1</expected-problems>
        <expected-messages>
            <message>The method bar() has an NPath complexity of 2</message>
        </expected-messages>
        <code><![CDATA[
public class Foo {
 public static void bar() {
  if (true) {List buz = new ArrayList();}
 }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
failure case
     ]]></description>
        <expected-problems>1</expected-problems>
        <code><![CDATA[
public class Foo {
 public static int bar() {
  try{
  if (true) {List buz = new ArrayList();}
  for(int i = 0; i < 19; i++) {List buz = new ArrayList();}
  int j = 0;
  if (true) {j = 10;}
  while (j++ < 20) {List buz = new ArrayList();}
  if (true) {j = 21;}
  if(false) {j = 0;}
  do {List buz = new ArrayList();} while (j++ < 30); 
  } catch(Exception e){
  if (true) {e.printStackTrace();}
 }
  if (true) {return 1;}
  else {return 2;}
 }
}
     ]]></code>
    </test-code>
    <code-fragment id="bug3484404"><![CDATA[
class Bar
{
    public void x(boolean x, boolean y)
    {
        z(
            (x ? 1 : 2),
            (y ? 3 : 4)
        );
    }

    public int y(boolean x, boolean y)
    {
        return z(
            (x ? 1 : 2),
            (y ? 3 : 4)
        );
    }

    public int z(int x, int y)
    {
        return x + y;
    }
}
    ]]></code-fragment>
    <test-code>
        <description>test case for bug 3484404 (Invalid NPath calculation in return statement)</description>
        <expected-problems>0</expected-problems>
        <code-ref id="bug3484404"/>
    </test-code>
    <test-code>
        <description>test case for bug 3484404 (Invalid NPath calculation in return statement) with minimum 25</description>
        <rule-property name="minimum">25.0</rule-property>
        <expected-problems>2</expected-problems>
        <expected-messages>
            <message>The method x() has an NPath complexity of 25</message>
            <message>The method y() has an NPath complexity of 25</message>
        </expected-messages>
        <code-ref id="bug3484404"/>
    </test-code>
</test-data>
