Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

junit 5 expected exception

@Test
void testExpectedException() {
 
  Assertions.assertThrows(NumberFormatException.class, () -> {
    Integer.parseInt("One");
  });
 
}
Source by howtodoinjava.com #
 
PREVIOUS NEXT
Tagged: #junit #expected #exception
ADD COMMENT
Topic
Name
7+5 =