use of com.sun.tck.lib.tgf.TestData in project jtharness by openjdk.
the class IteratorAsSupportedDataContainer method iteratorAsReturnType_ints_2.
@org.junit.Test
public void iteratorAsReturnType_ints_2() {
final List<Integer> is = new ArrayList<Integer>();
com.oracle.tck.lib.autd2.TestResult status = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(new BaseTestGroup() {
Iterator<Integer[]> intIterator = Arrays.<Integer[]>asList(new Integer[] { 89898 }, new Integer[] { 34324 }, new Integer[] { 34 }).iterator();
@TestCase
@TestData("intIterator")
public void test(int i) throws Throwable {
is.add(i);
}
}, TU.EMPTY_ARGV);
Assert.assertTrue(status.isOK());
Assert.assertEquals(3, is.size());
Assert.assertEquals(89898, (int) is.get(0));
Assert.assertEquals(34324, (int) is.get(1));
Assert.assertEquals(34, (int) is.get(2));
}
use of com.sun.tck.lib.tgf.TestData in project jtharness by openjdk.
the class IteratorAsSupportedDataContainer method test_04_IteratorOfIntegers_01.
@Test
public void test_04_IteratorOfIntegers_01() {
@TestGroup
class Test {
Iterator<Integer> component = Arrays.asList(1, 2, 3, 4, 5).iterator();
int counter = 0;
@TestCase
public void test(@TestData("component") int x) {
counter++;
}
}
Test tg = new Test();
com.oracle.tck.lib.autd2.TestResult s = TU.runTestGroup(tg);
Assert.assertTrue(s.isOK());
Assert.assertEquals(5, tg.counter);
Assert.assertEquals("test cases: 1; all passed", s.getMessage());
}
use of com.sun.tck.lib.tgf.TestData in project jtharness by openjdk.
the class IteratorAsSupportedDataContainer method iteratorAsReturnType_ints.
@org.junit.Test
public void iteratorAsReturnType_ints() {
final List<Integer> is = new ArrayList<Integer>();
final List<Integer> js = new ArrayList<Integer>();
com.oracle.tck.lib.autd2.TestResult status = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(new BaseTestGroup() {
Iterator<Object[]> intIterator = Arrays.<Object[]>asList(new Integer[] { 89898, 176253 }, new Integer[] { 34324, 343424 }).iterator();
@TestCase
@TestData("intIterator")
public void test(int i, int j) throws Throwable {
is.add(i);
js.add(j);
}
}, TU.EMPTY_ARGV);
Assert.assertTrue(status.isOK());
Assert.assertEquals(2, is.size());
Assert.assertEquals(2, js.size());
Assert.assertEquals(89898, (int) is.get(0));
Assert.assertEquals(176253, (int) js.get(0));
Assert.assertEquals(34324, (int) is.get(1));
Assert.assertEquals(343424, (int) js.get(1));
}
use of com.sun.tck.lib.tgf.TestData in project jtharness by openjdk.
the class InvalidTestCases method noTestCaseAnn_onlyTestData_02.
@Test
public void noTestCaseAnn_onlyTestData_02() {
try {
com.oracle.tck.lib.autd2.TestResult status = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(new BaseTestGroup() {
@TestData("something")
private void myTest02() {
}
}, TU.EMPTY_ARGV);
Assert.fail("IAE was not thrown");
} catch (IllegalArgumentException e) {
assertEquals(MARKING_METHOD_ONLY_WITH_TEST_DATA_IS_NOT_ALLOWED_PLEASE_ADD_TEST_CASE_ANNOTATION_TO_METHOD + "myTest02\".", e.getMessage());
}
}
use of com.sun.tck.lib.tgf.TestData in project jtharness by openjdk.
the class InvalidTestCases method overLoaded_message.
@Test
public void overLoaded_message() {
try {
com.oracle.tck.lib.autd2.TestResult status = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(new BaseTestGroup() {
@TestCase
@TestData("something")
public void myTest(int i) {
}
@TestCase
@TestData("something")
public void myTest(String s) {
}
}, TU.EMPTY_ARGV);
Assert.fail("Exception was not thrown");
} catch (IllegalArgumentException e) {
assertEquals("Overloaded testcases are not supported. Method \"myTest\" is overloaded.", e.getMessage());
}
}
Aggregations