Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

junit 5 assert exception message

Throwable exceptionThatWasThrown = assertThrows(NullPointerException.class, () -> {
    codeThatThrows;
});

assertThat(exceptionThatWasThrown.getMessage(), equalTo("Message I expected to be thrown"));
Source by blog.8bitzen.com #
 
PREVIOUS NEXT
Tagged: #junit #assert #exception #message
ADD COMMENT
Topic
Name
7+1 =