Delete redundant curly braces when using single lambda statement

This commit is contained in:
Alex Golub
2022-04-21 10:30:28 +03:00
parent 79d31ebc1d
commit cb11de0f0c

View File

@@ -9,9 +9,7 @@ class ExceptionAssertionUnitTest {
@Test
void whenExceptionThrown_thenAssertionSucceeds() {
Exception exception = assertThrows(NumberFormatException.class, () -> {
Integer.parseInt("1a");
});
Exception exception = assertThrows(NumberFormatException.class, () -> Integer.parseInt("1a"));
String expectedMessage = "For input string";
String actualMessage = exception.getMessage();
@@ -21,9 +19,7 @@ class ExceptionAssertionUnitTest {
@Test
void whenDerivedExceptionThrown_thenAssertionSucceds() {
Exception exception = assertThrows(RuntimeException.class, () -> {
Integer.parseInt("1a");
});
Exception exception = assertThrows(RuntimeException.class, () -> Integer.parseInt("1a"));
String expectedMessage = "For input string";
String actualMessage = exception.getMessage();