// ... and fail if the exception is not thrown
fail("ConditionTimeoutException expected.");
} catch (ConditionTimeoutException e) {
// check that the thrown exception has a DeadlockException attached to it
DeadlockException cause = (DeadlockException) e.getCause();
assertTrue(cause instanceof DeadlockException);
assertEquals(2, cause.getThreadInfos().length);
} finally {
// interrupt both threads to clean up the JVM
t1.interrupt();
t2.interrupt();