1@Test
2public void whenExceptionThrown_thenAssertionSucceeds() {
3 Exception exception = assertThrows(NumberFormatException.class, () -> {
4 Integer.parseInt("1a");
5 });
6
7 String expectedMessage = "For input string";
8 String actualMessage = exception.getMessage();
9
10 assertTrue(actualMessage.contains(expectedMessage));
11}