use of com.sun.tck.test.TestGroup in project jtharness by openjdk.
the class FailingSimpleTestCases method ExceptionsThrownFromStatus_01.
@Test
public void ExceptionsThrownFromStatus_01() {
final AtomicBoolean testCase_1_called = new AtomicBoolean();
final AtomicBoolean testCase_2_called = new AtomicBoolean();
final AtomicBoolean testCase_3_called = new AtomicBoolean();
@TestGroup
class TestGr {
@TestCase
public void test1() {
testCase_1_called.set(true);
}
@TestCase
public Status test2() {
testCase_2_called.set(true);
throw new RuntimeException();
}
@TestCase
public Status test3() {
testCase_3_called.set(true);
return Status.passed("Well. OK");
}
}
TestResult s = TU.runTestGroup(new TestGr(), TU.EMPTY_ARGV);
Assert.assertTrue(!s.isOK());
Assert.assertTrue(testCase_1_called.get());
Assert.assertTrue(testCase_2_called.get());
Assert.assertTrue(testCase_3_called.get());
Assert.assertEquals("test cases: 3; passed: 2; failed: 1; failed: [test2]", s.getMessage());
testCase_1_called.set(false);
testCase_2_called.set(false);
testCase_3_called.set(false);
PrintWriter log = new PrintWriter(System.err, true);
PrintWriter ref = new PrintWriter(System.out, true);
s = TU.runTestGroup(new TestGr());
Assert.assertTrue(!s.isOK());
Assert.assertTrue(testCase_1_called.get());
Assert.assertTrue(testCase_2_called.get());
Assert.assertTrue(testCase_3_called.get());
Assert.assertEquals("test cases: 3; passed: 2; failed: 1; failed: [test2]", s.getMessage());
}
use of com.sun.tck.test.TestGroup in project jtharness by openjdk.
the class FailingSimpleTestCases method testedAPI_package.
@Test
public void testedAPI_package() {
@TestedAPI(testedPackage = "x.e.r")
@TestGroup
class MyTest {
@TestCase
@TestedStatement("a statement")
public void testCase() {
Assert.fail();
}
}
TestResult s = TU.runTestGroup(new MyTest(), TU.EMPTY_ARGV);
Assert.assertTrue(!s.isOK());
Assert.assertEquals("test cases: 1; all failed", s.getMessage());
}
use of com.sun.tck.test.TestGroup 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.test.TestGroup in project jtharness by openjdk.
the class BranchAndUniteSetups method test.
@org.junit.Test
public void test() {
final BranchAndUniteSetups.MyTestedInstance mock = mock(BranchAndUniteSetups.MyTestedInstance.class);
@TestGroup
class MyTest {
Values setup1() {
Values values2 = DataFactory.createColumn((Object[]) ROW_3).multiply((Object[]) ROW_4);
Values values1 = DataFactory.createColumn((Object[]) ROW_1).multiply((Object[]) ROW_2);
return values1.unite(values2);
}
@TestCase
@TestData("setup1")
public void test(String s1, String s2) {
mock.method(s1, s2);
}
}
com.oracle.tck.lib.autd2.TestResult status = TU.runTestGroup(new MyTest());
Assert.assertTrue(status.isOK());
for (String s1 : ROW_1) {
for (String s2 : ROW_2) {
verify(mock).method(s1, s2);
}
}
for (String s3 : ROW_3) {
for (String s4 : ROW_4) {
verify(mock).method(s3, s4);
}
}
}
use of com.sun.tck.test.TestGroup in project jtharness by openjdk.
the class Examples method test_07.
@Test
public void test_07() {
@TestGroup
class TestTransformingIterator {
Values multiplyValues = DataFactory.createValues(new Comparable<?>[][] { { 1, 2 }, { 3, 4 } }).multiply(DataFactory.createValues(new Comparable<?>[][] { { 5, 6 }, { 7, 8 } })).filter((Comparable<?> c1, Comparable<?> c2, Comparable<?> c3, Comparable<?> c4) -> DataFactory.createRow(c1));
@TestCase
@TestData("multiplyValues")
public void testToString(Integer i) {
}
}
com.oracle.tck.lib.autd2.TestResult s = TU.runTestGroup(new TestTransformingIterator());
Assert.assertTrue(s.isOK());
Assert.assertEquals("test cases: 1; all passed", s.getMessage());
}
Aggregations