use of org.junit.runner.JUnitCore in project junit4 by junit-team.
the class TimeoutTest method failureWithTimeout.
@Test
public void failureWithTimeout() throws Exception {
JUnitCore core = new JUnitCore();
Result result = core.run(FailureWithTimeoutTest.class);
assertEquals(1, result.getRunCount());
assertEquals(1, result.getFailureCount());
assertEquals(AssertionError.class, result.getFailures().get(0).getException().getClass());
}
use of org.junit.runner.JUnitCore in project junit4 by junit-team.
the class TimeoutTest method timeoutFailure.
@Ignore("was breaking gump")
@Test
public void timeoutFailure() throws Exception {
JUnitCore core = new JUnitCore();
Result result = core.run(TimeoutFailureTest.class);
assertEquals(1, result.getRunCount());
assertEquals(1, result.getFailureCount());
assertEquals(InterruptedException.class, result.getFailures().get(0).getException().getClass());
}
use of org.junit.runner.JUnitCore in project junit4 by junit-team.
the class TimeoutTest method stalledThreadAppearsInStackTrace.
@Test
public void stalledThreadAppearsInStackTrace() throws Exception {
JUnitCore core = new JUnitCore();
Result result = core.run(InfiniteLoopTest.class);
assertEquals(1, result.getRunCount());
assertEquals(1, result.getFailureCount());
Throwable exception = result.getFailures().get(0).getException();
// Make sure we have the stalled frame on the stack somewhere
assertThat(stackForException(exception), containsString("infiniteLoop"));
}
use of org.junit.runner.JUnitCore in project junit4 by junit-team.
the class TimeoutTest method timeoutFailureMultithreaded.
@Test
public void timeoutFailureMultithreaded() throws Exception {
JUnitCore core = new JUnitCore();
Result result = core.run(InfiniteLoopWithStuckThreadTest.class);
assertEquals(1, result.getRunCount());
assertEquals(2, result.getFailureCount());
Throwable[] exception = new Throwable[2];
for (int i = 0; i < 2; i++) exception[i] = result.getFailures().get(i).getException();
assertThat(exception[0].getMessage(), containsString("test timed out after 100 milliseconds"));
assertThat(stackForException(exception[0]), containsString("Thread.join"));
assertThat(exception[1].getMessage(), containsString("Appears to be stuck in thread timeout-thr2"));
}
use of org.junit.runner.JUnitCore in project junit4 by junit-team.
the class AnnotationTest method testOldSuiteTest.
public void testOldSuiteTest() throws Exception {
TestSuite suite = new TestSuite(OldSuiteTest.class);
JUnitCore runner = new JUnitCore();
runner.run(suite);
assertTrue(run);
}
Aggregations