use of com.sun.tck.test.TestCase in project jtharness by openjdk.
the class ReferenceAttachedToParam method shorts_1.
@org.junit.Test
public void shorts_1() {
final List<Integer> list = new ArrayList<Integer>();
com.oracle.tck.lib.autd2.TestResult status = TU.runTestGroup(new BaseTestGroup() {
Values ints = DataFactory.createColumn(23, 423);
@TestCase
public void test(@TestData("ints") int i) throws Throwable {
list.add(i);
}
});
Assert.assertTrue(status.isOK());
Assert.assertEquals(2, list.size());
Assert.assertEquals(23, list.get(0), 0.0);
Assert.assertEquals(423, list.get(1), 0.0);
}
use of com.sun.tck.test.TestCase in project jtharness by openjdk.
the class ReferenceAttachedToParam method mixed_mult_2.
@org.junit.Test
public void mixed_mult_2() {
final List<Class<?>> list_1 = new ArrayList<Class<?>>();
final List<String> list_2 = new ArrayList<String>();
com.oracle.tck.lib.autd2.TestResult status = TU.runTestGroup(new BaseTestGroup() {
Values strings_ = DataFactory.createColumn("aa", "bb", "cc");
@TestCase
@Operation(Operation.TYPE.MULTIPLY)
public void test(@Classes({ String.class, Throwable.class }) Class<?> c, @TestData("strings_") String s) throws Throwable {
list_1.add(c);
list_2.add(s);
}
});
Assert.assertTrue(status.isOK());
Assert.assertEquals(6, list_1.size());
Assert.assertEquals(6, list_2.size());
Assert.assertEquals(String.class, list_1.get(0));
Assert.assertEquals(String.class, list_1.get(1));
Assert.assertEquals(String.class, list_1.get(2));
Assert.assertEquals(Throwable.class, list_1.get(3));
Assert.assertEquals(Throwable.class, list_1.get(4));
Assert.assertEquals(Throwable.class, list_1.get(5));
Assert.assertEquals("aa", list_2.get(0));
Assert.assertEquals("bb", list_2.get(1));
Assert.assertEquals("cc", list_2.get(2));
Assert.assertEquals("aa", list_2.get(3));
Assert.assertEquals("bb", list_2.get(4));
Assert.assertEquals("cc", list_2.get(5));
}
use of com.sun.tck.test.TestCase 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());
}
}
use of com.sun.tck.test.TestCase in project jtharness by openjdk.
the class Examples method test_03_array.
@Test
public void test_03_array() {
@TestGroup
class Test {
Values quantities = createColumn(new Color[] { BLUE, BLACK, WHITE }, new Color[] { BLACK, WHITE, BLUE, GREEN }, new Color[] { BLUE, BLACK }, new Color[] { RED }).<Color[]>filter(colors -> createRow(colors.length));
@TestCase
@TestData("quantities")
public void test(int quantity) {
assertTrue(quantity > 0);
}
}
com.oracle.tck.lib.autd2.TestResult s = TU.runTestGroup(new Test());
Assert.assertTrue(s.isOK());
Assert.assertEquals("test cases: 1; all passed", s.getMessage());
}
use of com.sun.tck.test.TestCase in project jtharness by openjdk.
the class Cache method runTest.
private long runTest(final Values column, boolean createCache) {
final long start = System.currentTimeMillis();
final Values dataToUse = createCache ? column.createCache() : column;
TU.runTestGroup(new BaseTestGroup() {
Values setup() {
return dataToUse.multiply(dataToUse);
}
@TestCase
@TestData("setup")
public void theTest(TestObject t1, TestObject t2) {
}
});
return System.currentTimeMillis() - start;
}
Aggregations