<?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[
assertArrayEquals ok
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
import junit.framework.TestCase;
public class Foo extends TestCase {
 public void test1() {
  assertArrayEquals("[1] != [1]", new int[] {1}, new int[] {1});
 }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
assertArrayEquals bad
     ]]></description>
        <expected-problems>1</expected-problems>
        <code><![CDATA[
import junit.framework.TestCase;
public class Foo extends TestCase {
 public void test1() {
  assertArrayEquals(new int[] {1}, new int[] {1});
 }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
assertEquals ok
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
import junit.framework.TestCase;
public class Foo extends TestCase {
 public void test1() {
  assertEquals("1 != 1", 1, 1);
 }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
assertEquals with string variable as message ok
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
import junit.framework.TestCase;
public class Foo extends TestCase {
 public void test1() {
  String s = "1 != 1";
  assertEquals(s, 1, 1);
 }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
assertEquals with delta ok
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
import junit.framework.TestCase;
public class Foo extends TestCase {
 public void test1() {
  assertEquals("foo", 1, 2, 3);
 }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
assertEquals bad
     ]]></description>
        <expected-problems>1</expected-problems>
        <code><![CDATA[
import junit.framework.TestCase;
public class Foo extends TestCase {
 public void test1() {
  assertEquals(1, 1);
 }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
assertEquals with delta bad
     ]]></description>
        <expected-problems>1</expected-problems>
        <code><![CDATA[
import junit.framework.TestCase;
public class Foo extends TestCase {
 public void test1() {
  assertEquals(1, 2, 3);
 }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
assertEquals with delta but missing assertion message not ok
     ]]></description>
        <expected-problems>1</expected-problems>
        <code><![CDATA[
import junit.framework.TestCase;
public class Foo extends TestCase {
 public void test1() {
  double d = 1;
  assertEquals(d, 1, 1);
 }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
assertFalse ok
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
import junit.framework.TestCase;
public class Foo extends TestCase {
 public void testBar() {
  assertFalse("foo!", "foo".equals("foo"));
 }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
assertFalse bad
     ]]></description>
        <expected-problems>1</expected-problems>
        <code><![CDATA[
import junit.framework.TestCase;
public class Foo extends TestCase {
 public void testBar() {
  assertFalse("foo".equals("foo"));
 }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
assertNotNull OK
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
import junit.framework.TestCase;
public class Foo extends TestCase {
 public void test1() {
  assertNotNull("foo", null);
 }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
assertNotNull bad
     ]]></description>
        <expected-problems>1</expected-problems>
        <code><![CDATA[
import junit.framework.TestCase;
public class Foo extends TestCase {
 public void test1() {
  assertNotNull(null);
 }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
assertNotSame ok
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
import junit.framework.TestCase;
public class Foo extends TestCase {
 public void test1() {
  assertNotSame("1 == 2", 1, 2);
 }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
assertNotSame bad
     ]]></description>
        <expected-problems>1</expected-problems>
        <code><![CDATA[
import junit.framework.TestCase;
public class Foo extends TestCase {
 public void test1() {
  assertNotSame(1, 2);
 }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
assertNull OK
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
import junit.framework.TestCase;
public class Foo extends TestCase {
 public void test1() {
  assertNull("it's not null", null);
 }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
assertNull bad
     ]]></description>
        <expected-problems>1</expected-problems>
        <code><![CDATA[
import junit.framework.TestCase;
public class Foo extends TestCase {
 public void test1() {
  assertNull(null);
 }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
assertSame OK
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
import junit.framework.TestCase;
public class Foo extends TestCase {
 public void test1() {
  assertSame("not same!", null, null);
 }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
assertSame bad
     ]]></description>
        <expected-problems>1</expected-problems>
        <code><![CDATA[
import junit.framework.TestCase;
public class Foo extends TestCase {
 public void test1() {
  assertSame(null, null);
 }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
assertThat ok
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
import junit.framework.TestCase;
public class Foo extends TestCase {
 public void test1() {
  assertThat("Zero is one", 0, is(not(1)));
 }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
assertThat bad
     ]]></description>
        <expected-problems>1</expected-problems>
        <code><![CDATA[
import junit.framework.TestCase;
public class Foo extends TestCase {
 public void test1() {
  assertThat(0, is(not(1)));
 }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
assertTrue ok
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
import junit.framework.TestCase;
public class Foo extends TestCase {
 public void test1() {
  assertTrue("foo", "foo".equals("foo"));
 }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
assertTrue bad
     ]]></description>
        <expected-problems>1</expected-problems>
        <code><![CDATA[
import junit.framework.TestCase;
public class Foo extends TestCase {
 public void test1() {
  assertTrue("foo".equals("foo"));
 }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
fail ok
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
import junit.framework.TestCase;
public class Foo extends TestCase {
 public void test1() {
  fail("foo");
 }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
fail bad
     ]]></description>
        <expected-problems>1</expected-problems>
        <code><![CDATA[
import junit.framework.TestCase;
public class Foo extends TestCase {
 public void test1() {
  fail();
 }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
find that pesky bug
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
import junit.framework.TestCase;
public class Foo extends TestCase {
 public void test1() {
  this.test1("foo");
 }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
Not a JUnit test - assertEquals bad
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
public class Foo {
 public void test1() {
  assertEquals(1, 1);
 }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
JUnit 4 - assertEquals
     ]]></description>
        <expected-problems>1</expected-problems>
        <code><![CDATA[
import org.junit.Test;
public class Foo {
 @Test
 public void foo() {
  assertEquals(1, 1);
 } 
}
     ]]></code>
    </test-code>
    <test-code>
        <description>#1374 JUnitAssertionsShouldIncludeMessage does not work</description>
        <expected-problems>4</expected-problems>
        <expected-linenumbers>10,11,12,13</expected-linenumbers>
        <code><![CDATA[
import static org.hamcrest.Matchers.containsString;

import org.junit.Assert;
import org.junit.Test;

public class TestClass extends Assert {

    @Test
    public void test() {
        assertTrue(true);
        assertEquals("", "");
        assertNull(null);
        assertThat("", containsString(""));
    }
}
        ]]></code>
    </test-code>
    <test-code>
        <description>#1373 JUnitAssertionsShouldIncludeMessage is no longer compatible with TestNG</description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
import org.testng.annotations.Test;
import static org.testng.Assert.*;

public class TestNgTestCase {
    @Test
    public void testAssert() {
        assertEquals("a", "b", "message");
        assertEquals(1, 2, "message");
        assertFalse(true, "message");
        assertTrue(false, "message");
        assertNotEquals(new Object(), new Object(), "message");
        assertNotNull(null, "message");
        assertNull(null, "message");
    }
}
        ]]></code>
    </test-code>
</test-data>
