Skip to content

Commit e9a75f4

Browse files
committed
Merge test for exception type and message
IMO this is conceptually one assert because the message and the exception type are strongly coupled.
1 parent d27ad52 commit e9a75f4

1 file changed

Lines changed: 2 additions & 9 deletions

File tree

src/test/java/org/junit/internal/runners/statements/FailOnTimeoutTest.java

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,9 @@ public void noExceptionIsThrownWhenWrappedStatementFinishesBeforeTimeoutWithoutT
5555
}
5656

5757
@Test
58-
public void throwsTestTimedOutException() {
59-
assertThrows(
60-
TestTimedOutException.class,
61-
run(failAfter50Ms(new RunForASecond())));
62-
}
63-
64-
@Test
65-
public void throwExceptionWithNiceMessageOnTimeout() {
58+
public void throwsTestTimedOutExceptionWithMeaningfulMessage() {
6659
Exception e = assertThrows(
67-
Exception.class,
60+
TestTimedOutException.class,
6861
run(failAfter50Ms(new RunForASecond())));
6962
assertEquals("test timed out after 50 milliseconds", e.getMessage());
7063
}

0 commit comments

Comments
 (0)