use of com.oracle.tck.lib.autd2.unittests.BaseTestGroup 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.unittests.BaseTestGroup 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.unittests.BaseTestGroup 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.unittests.BaseTestGroup 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;
}
use of com.oracle.tck.lib.autd2.unittests.BaseTestGroup in project jtharness by openjdk.
the class Filtering method arrayReturned_01.
@Test
public void arrayReturned_01() {
com.oracle.tck.lib.autd2.TestResult status = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(new BaseTestGroup() {
private Values values() {
Values values = createColumn(0, 1, 2).filter(new Object() {
@Transform
Integer[] create(int i) {
return new Integer[] { i, i + 1, i + 2 };
}
});
return createColumn("a", "b", "c").pseudoMultiply(values);
}
@TestCase
@TestData("values")
public void wrongTest(String s, Integer integer) throws Throwable {
System.out.println("s = " + s);
System.out.println("integers = " + integer);
}
}, TU.EMPTY_ARGV);
assertTrue(status.isOK());
}
Aggregations