}
@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"));
}