<?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>Contains tearDown</description>
        <expected-problems>1</expected-problems>
        <code><![CDATA[
import org.junit.Test;
public class Foo {
    public void tearDown() {
    }
    @Test
    public void foo() {
    }
}
        ]]></code>
    </test-code>

    <test-code>
        <description>Contains @After tearDown</description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
import org.junit.Test;
import org.junit.After;
public class Foo {
    @After
    public void tearDown() {
    }
    @Test
    public void foo() {
    }
}
        ]]></code>
    </test-code>

    <test-code>
        <description>Renamed tearDown</description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
import org.junit.Test;
import org.junit.After;
public class Foo {
    @After
    public void clean() {
    }
    @Test
    public void foo() {
    }
}
        ]]></code>
    </test-code>

    <test-code>
        <description>#1446 False positive with JUnit4TestShouldUseBeforeAnnotation when TestNG is used</description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
import org.testng.annotations.AfterMethod;
import org.testng.annotations.Test;

public class Foo {
    @AfterMethod
    public void tearDown(java.lang.reflect.Method m) {
      //...
    }
    @Test
    public void someTest() {}
}
        ]]></code>
    </test-code>

    <test-code>
        <description>#940 False positive with JUnit4TestShouldUseAfterAnnotation when JUnit5's 'AfterEach' is used</description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
import org.junit.jupiter.api.*;

public class Foo {
    @AfterEach
    public void tearDown() {
      //...
    }
    @Test
    public void someTest() {}

}
        ]]></code>
    </test-code>

    <test-code>
        <description>#940 False positive with JUnit4TestShouldUseAfterAnnotation when JUnit5's 'AfterAll' is used</description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
import org.junit.jupiter.api.*;

public class Foo {
    @AfterAll
    public void tearDown() {
      //...
    }
    @Test
    public void someTest() {}
}
        ]]></code>
    </test-code>
    <test-code>
        <description>Contains tearDown, not a junit 4 test</description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
            public class Foo {
                public void tearDown() {
                }
                public void foo() {
                }
            }
            ]]></code>
    </test-code>
    <test-code>
        <description>Contains tearDown with different signature</description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
            import org.junit.Test;
            public class Foo {
                public void tearDown(int something) {
                }
                @Test
                public void foo() {
                }
            }
            ]]></code>
    </test-code>

    <test-code>
        <description>[java] JUnit4TestShouldUseBeforeAnnotation false positive when overriding setUp #1592</description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
import net.sourceforge.pmd.lang.java.rule.bestpractices.JUnit4TestShouldUseBeforeAnnotationTest.BaseTest;

public class AReallyCoolFeatureTest extends BaseTest {
    @Override
    public void setUp() {
        super.setUp();
    }

    @Override
    public void tearDown() {
        super.tearDown();
    }
}
        ]]></code>
    </test-code>
</test-data>
