use of com.sun.tck.test.TestGroup in project jtharness by openjdk.
the class Examples method test_03.
@Test
public void test_03() {
@TestGroup
class Test {
Values colors = createColumn(BLUE, BLACK, WHITE).<Color>filter(c -> createRow(c.darker(), c.brighter()));
@TestCase
@TestData("colors")
public void test(Color darker, Color brighter) {
assertTrue(darker.getRed() <= brighter.getRed());
assertTrue(darker.getGreen() <= brighter.getGreen());
assertTrue(darker.getBlue() <= brighter.getBlue());
}
}
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.TestGroup in project jtharness by openjdk.
the class FailingSimpleTestCases method testedAPI_package_class_methods.
@Test
public void testedAPI_package_class_methods() {
@TestedAPI(testedPackage = "s.e.g", testedClass = "TheClass", testedMember = { "method1", "method2" })
@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 FailingSimpleTestCases method threeMixedTestCases_AUTD2StatusRecognizingProcessor_01.
@Test
public void threeMixedTestCases_AUTD2StatusRecognizingProcessor_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
@ExpectedExceptions(IllegalArgumentException.class)
public void test1() {
testCase_1_called.set(true);
throw new IllegalArgumentException();
}
@TestCase
public Status test2() {
testCase_2_called.set(true);
return Status.passed("Status passed");
}
@TestCase
public void test3() {
testCase_3_called.set(true);
}
}
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; all passed", s.getMessage());
}
use of com.sun.tck.test.TestGroup in project jtharness by openjdk.
the class FailingSimpleTestCases method ExceptionsThrownFromStatus.
@Test
public void ExceptionsThrownFromStatus() {
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);
throw new RuntimeException();
}
}
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: 1; failed: 2; failed: [test2, test3]", s.getMessage());
}
use of com.sun.tck.test.TestGroup in project jtharness by openjdk.
the class FailingSimpleTestCases method testedAPI_package_class_method.
@Test
public void testedAPI_package_class_method() {
@TestedAPI(testedPackage = "s.e.g", testedClass = "TheClass", testedMember = "method1")
@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());
}
Aggregations