Skip to content

Commit

Permalink
Merge test for exception type and message
Browse files Browse the repository at this point in the history
IMO this is conceptually one assert because the message and the
exception type are strongly coupled.
  • Loading branch information
stefanbirkner committed Jan 20, 2021
1 parent d27ad52 commit e9a75f4
Showing 1 changed file with 2 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,9 @@ public void noExceptionIsThrownWhenWrappedStatementFinishesBeforeTimeoutWithoutT
}

@Test
public void throwsTestTimedOutException() {
assertThrows(
TestTimedOutException.class,
run(failAfter50Ms(new RunForASecond())));
}

@Test
public void throwExceptionWithNiceMessageOnTimeout() {
public void throwsTestTimedOutExceptionWithMeaningfulMessage() {
Exception e = assertThrows(
Exception.class,
TestTimedOutException.class,
run(failAfter50Ms(new RunForASecond())));
assertEquals("test timed out after 50 milliseconds", e.getMessage());
}
Expand Down

0 comments on commit e9a75f4

Please sign in to comment.