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 f1801bbd6f
commit 0af6112abf
1 changed files with 2 additions and 6 deletions

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();