use of com.sun.tck.lib.tgf.TestData in project jtharness by openjdk.
the class DataQueriesFromFields method test_5.
@org.junit.Test
public void test_5() {
final Set<Integer> set = new HashSet<Integer>();
com.oracle.tck.lib.autd2.TestResult status = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(new BaseTestGroup() {
private ValuesHolder4 holder4 = new ValuesHolder4();
@TestCase
@TestData("holder4.ints")
public void test(int i) throws Throwable {
set.add(i);
}
}, TU.EMPTY_ARGV);
Assert.assertTrue(status.isOK());
Assert.assertEquals(4, set.size());
Assert.assertTrue(set.contains(344));
Assert.assertTrue(set.contains(556));
Assert.assertTrue(set.contains(655));
Assert.assertTrue(set.contains(33));
}
use of com.sun.tck.lib.tgf.TestData in project jtharness by openjdk.
the class DataQueriesFromFields method test_2.
@org.junit.Test
public void test_2() {
final Set<Integer> set = new HashSet<Integer>();
com.oracle.tck.lib.autd2.TestResult status = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(new BaseTestGroup() {
private ValuesHolder2 holder2 = new ValuesHolder2();
@TestCase
@TestData("holder2.holder.setup")
public void test(int i) throws Throwable {
set.add(i);
}
}, TU.EMPTY_ARGV);
Assert.assertTrue(status.isOK());
Assert.assertEquals(4, set.size());
Assert.assertTrue(set.contains(1));
Assert.assertTrue(set.contains(3));
Assert.assertTrue(set.contains(7));
Assert.assertTrue(set.contains(9));
}
use of com.sun.tck.lib.tgf.TestData in project jtharness by openjdk.
the class IteratorAsSupportedDataContainer method iteratorAsReturnType_strings.
@org.junit.Test
public void iteratorAsReturnType_strings() {
final List<String> is = new ArrayList<String>();
final List<String> js = new ArrayList<String>();
com.oracle.tck.lib.autd2.TestResult status = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(new BaseTestGroup() {
Iterator<Object[]> stringITerator = Arrays.<Object[]>asList(new String[] { "a", "b" }, new String[] { "v", "n" }).iterator();
@TestCase
@TestData("stringITerator")
public void test(String i, String 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("a", is.get(0));
Assert.assertEquals("b", js.get(0));
Assert.assertEquals("v", is.get(1));
Assert.assertEquals("n", js.get(1));
}
use of com.sun.tck.lib.tgf.TestData in project jtharness by openjdk.
the class IteratorAsSupportedDataContainer method test_04_IteratorOfIntegers.
@Test
public void test_04_IteratorOfIntegers() {
@TestGroup
class Test {
Iterator<Integer> component() {
return IntStream.range(55, 67).iterator();
}
int counter;
@TestCase
@Operation(MULTIPLY)
public void test(@TestData("component") int r, @TestData("component") int g, @TestData("component") int b) {
Color color = new Color(r, g, b);
assertEquals(r, color.getRed());
assertEquals(g, color.getGreen());
assertEquals(b, color.getBlue());
counter++;
}
}
Test tg = new Test();
com.oracle.tck.lib.autd2.TestResult s = TU.runTestGroup(tg);
Assert.assertTrue(s.isOK());
Assert.assertEquals(1728, 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 InvalidTestCases method noTestCaseAnn_onlyTestData_05.
@Test
public void noTestCaseAnn_onlyTestData_05() {
try {
com.oracle.tck.lib.autd2.TestResult status = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(new BaseTestGroup() {
@TestData("blabla")
protected void myTest01(int i) {
}
@TestCase
public 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 + "myTest01\".", e.getMessage());
}
}
Aggregations