<?xml version="1.0" encoding="UTF-8"?>
<test-data>
    <code-fragment id="basic-violation">
    <![CDATA[
public class Foo {
 public void example() {
  int x = 0;
  int a = 0;
  int b = 0;
  int c = 0;
  int d = 0;
  int a1 = 0;
  int a2 = 0;
  int b1 = 0;
  int b2 = 0;
  int z = 0;
  int h = 0;
  int e = 0;
  int f = 0;

  if (a == b) {
      if (a1 == b1) {
   x = 2;
      } else if (a2 == b2) {
   x = 2;
      } else {
   x = 2;
      }
  } else if (c == d) {
      while (c == d) {
   x = 2;
      }
  } else if (e == f) {
      for (int n = 0; n < h; n++) {
   x = 2;
      }
  } else {
      switch (z) {
      case 1:
   x = 2;
   break;

      case 2:
   x = 2;
   break;

      case 3:
   x = 2;
   break;

      default:
   x = 2;
   break;
      }
  }
 }
}
     ]]>
    </code-fragment>
    <test-code>
        <description>Simple method</description>
        <rule-property name="reportLevel">1</rule-property>
        <expected-problems>2</expected-problems>
        <expected-messages>
            <message>The class 'Foo' has a Modified Cyclomatic Complexity of 2 (Highest = 1).</message>
            <message>The method 'foo' has a Modified Cyclomatic Complexity of 1.</message>
        </expected-messages>
        <code><![CDATA[
public class Foo {
 public void foo() {}
}
     ]]></code>
    </test-code>
    <test-code>
        <description>testLessComplicatedThanReportLevel</description>
        <rule-property name="reportLevel">10</rule-property>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
public class Foo {
 public void foo() {}
}
        ]]></code>
    </test-code>
    <test-code>
        <description>Complicated method</description>
        <rule-property name="reportLevel">8</rule-property>
        <expected-problems>2</expected-problems>
        <expected-messages>
            <message>The class 'Foo' has a Modified Cyclomatic Complexity of 10 (Highest = 9).</message>
            <message>The method 'example' has a Modified Cyclomatic Complexity of 9.</message>
        </expected-messages>
        <code-ref id="basic-violation"/>
    </test-code>
    <test-code>
        <description>Constructor</description>
        <rule-property name="reportLevel">1</rule-property>
        <expected-problems>2</expected-problems>
        <expected-messages>
            <message>The class 'Foo' has a Modified Cyclomatic Complexity of 2 (Highest = 1).</message>
            <message>The constructor 'Foo' has a Modified Cyclomatic Complexity of 1.</message>
        </expected-messages>
        <code><![CDATA[
public class Foo {
 public Foo() {}
}
     ]]></code>
    </test-code>
</test-data>
