Horje
test thrown expected with jupiter spring boot Code Example
test thrown expected with jupiter spring boot
@Test
public void whenExceptionThrown_thenAssertionSucceeds() {
    Exception exception = assertThrows(NumberFormatException.class, () -> {
        Integer.parseInt("1a");
    });

    String expectedMessage = "For input string";
    String actualMessage = exception.getMessage();

    assertTrue(actualMessage.contains(expectedMessage));
}




Java

Related
char array to arraylist java Code Example char array to arraylist java Code Example
add certificate to java truststore Code Example add certificate to java truststore Code Example
how to remove null values collections Code Example how to remove null values collections Code Example
java first letter to upper case Code Example java first letter to upper case Code Example
how to assert that an exception is thrown java Code Example how to assert that an exception is thrown java Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7