use of com.oracle.tck.lib.autd2 in project jtharness by openjdk.
the class InvalidTestCases method publicNonTestCaseMethod_message2.
@Test
public void publicNonTestCaseMethod_message2() {
try {
com.oracle.tck.lib.autd2.TestResult status = TU.runTestGroup(new BaseTestGroup() {
public void myTest4444444() {
}
});
Assert.fail("IAE was not thrown");
} catch (IllegalArgumentException e) {
assertEquals("Please either add @TestCase or @NonTestCase annotation to method \"com.oracle.tck.lib.autd2.unittests.tgfported.general.InvalidTestCases$23.myTest4444444\" or make it non-public. All public methods must have @TestCase annotation by default. As an exception a method which needs to be public but is not a testcase should be annotated with @NonTestCase annotation.", e.getMessage());
}
}
use of com.oracle.tck.lib.autd2 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.oracle.tck.lib.autd2 in project jtharness by openjdk.
the class TestCaseThrowsException method unexpectedRuntimeException.
@Test
public void unexpectedRuntimeException() {
PrintWriter log = TU.createMockedPrintWriter();
PrintWriter ref = TU.createMockedPrintWriter();
BaseTestGroup baseTestGroup = new BaseTestGroup() {
Values setup() {
return DataFactory.createColumn(115);
}
@TestCase
@TestData("setup")
public void theTest(int i) {
throw new CustomException(Integer.toString(i));
}
};
com.oracle.tck.lib.autd2.TestResult status = TU.runTestGroup(baseTestGroup, log, ref);
Assert.assertTrue(!status.isOK());
Assert.assertEquals("Failed. test cases: 1; all failed", status.toString());
InOrder inOrder = inOrder(log, ref);
inOrder.verify(log).println("Testcase \"theTest(0)\" has thrown an unexpected exception com.oracle.tck.lib.autd2.unittests.CustomException: 115");
inOrder.verify(log).println(CustomException.STACKTRACE_LINE);
inOrder.verify(log).println("Testcase \"theTest(0)\" failed with arguments [115]");
inOrder.verify(log).println("theTest: Failed. Testcase \"theTest(0)\" has thrown an unexpected exception com.oracle.tck.lib.autd2.unittests.CustomException: 115");
inOrder.verify(log).flush();
inOrder.verify(ref).flush();
verifyNoMoreInteractions(log, ref);
}
use of com.oracle.tck.lib.autd2 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());
}
use of com.oracle.tck.lib.autd2 in project jtharness by openjdk.
the class Examples method from_VMTests.
@Test
public void from_VMTests() {
@TestGroup
class TestTransformingIterator {
Values frames() {
Values rowsOfTypes = DataFactory.createValues(new String[][] { {}, { "a" }, { "a", "b" }, { "a", "b", "c", "d" } });
Values frames = rowsOfTypes.filter(new Object() {
@Transform
public Object transform(Object[] row1) {
Object[] copiedArray = Arrays.copyOf(row1, row1.length, (Class<? extends Object[]>) String[].class);
return DataFactory.createRow((Object) copiedArray);
}
}).filter((String[] stackState) -> new Object());
return frames;
}
@TestCase
@TestData("frames")
public void testToString(Object i) {
System.out.println("TestTransformingIterator.testToString");
System.out.println("i = " + 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