use of com.oracle.tck.lib.autd2.unittests.CustomException 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);
}
Aggregations