<?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><![CDATA[
method throws Exception
     ]]></description>
        <expected-problems>1</expected-problems>
        <code><![CDATA[
public class Foo {
 void foo() throws Exception {}
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
ok
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
public class Foo {
 void foo() {}
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
constructor throws Exception
     ]]></description>
        <expected-problems>1</expected-problems>
        <code><![CDATA[
public class Foo {
 Foo() throws Exception {}
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
skip junit setUp method
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
import junit.framework.*;
public class Foo {
 void setUp() throws Exception {}
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
skip junit tearDown method
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
import junit.framework.*;
public class Foo {
 void tearDown() throws Exception {}
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
JUnit 4 testcase
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
import org.junit.*;
public class Foo {
 @Before
 void setUp() throws Exception {}
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
skip method in class that extends TestCase
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
import junit.framework.*;
public class Foo extends TestCase {
 void setUp() throws Exception {}
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
Don't skip other methods
     ]]></description>
        <expected-problems>1</expected-problems>
        <code><![CDATA[
import junit.framework.*;
public class Foo extends TestCase {
 void bar() throws Exception {}
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
Unless 
     ]]></description>
        <rule-property name="IgnoreJUnitCompletely">true</rule-property>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
import junit.framework.*;
public class Foo extends TestCase {
 void bar() throws Exception {}
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
skip junit setUp method where the superclass is TestCase
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
public class Foo extends net.sourceforge.pmd.lang.java.rule.design.MyTestCase {
 void setUp() throws Exception {}
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
skip junit setUp method where the superclass is TestCase, imported explicitly
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
import net.sourceforge.pmd.lang.java.rule.design.MyTestCase;
public class Foo extends MyTestCase {
 void setUp() throws Exception {}
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
skip junit setUp method where the superclass is TestCase, but is imported implicitly
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
import net.sourceforge.pmd.lang.java.rule.design.*;
public class Foo extends MyTestCase {
 void setUp() throws Exception {}
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
skip junit setUp method where the superclass is TestCase  and is in the same package
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
package net.sourceforge.pmd.lang.java.rule.design;

public class Foo extends MyTestCase {
 void setUp() throws Exception {}
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
Generics
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
public class Foo {
 public <T> Bar<T> foo() { /* blah */}
}
     ]]></code>
        <source-type>java 1.5</source-type>
    </test-code>
    <test-code>
        <description><![CDATA[
skip any method starting with 'test'
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
public class FooTest {
 void testFoo() throws Exception {}
}
     ]]></code>
    </test-code>
    <test-code>
        <description>#913 SignatureDeclareThrowsException is raised twice</description>
        <expected-problems>1</expected-problems>
        <code><![CDATA[
public class BugSignature {
  public void record() {
    SwingWorker worker = new SwingWorker() {
      protected String construct() throws Exception {
        //
      }
    };
  }
}
]]></code>
    </test-code>

    <test-code>
        <description>#1535 [java] SignatureDeclareThrowsException: ClassCastException with Annotation</description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
public class UnmodifiableList<T> implements @Readonly List<@Readonly T> {}
        ]]></code>
    </test-code>
    
    <test-code>
        <description>#350 allow throws exception when overriding a method defined elsewhere</description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
public class BugSignature implements LousyInterface {
  @Override
  public void record() throws Exception {
  }
}
]]></code>
    </test-code>
</test-data>
