diff --git a/testing-modules/junit-5-basics/src/test/java/com/baeldung/assertexception/ExceptionAssertionUnitTest.java b/testing-modules/junit-5-basics/src/test/java/com/baeldung/assertexception/ExceptionAssertionUnitTest.java index ee2f696408..32e0e4a1cb 100644 --- a/testing-modules/junit-5-basics/src/test/java/com/baeldung/assertexception/ExceptionAssertionUnitTest.java +++ b/testing-modules/junit-5-basics/src/test/java/com/baeldung/assertexception/ExceptionAssertionUnitTest.java @@ -1,13 +1,14 @@ package com.baeldung.assertexception; +import org.junit.jupiter.api.Test; + import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; -import org.junit.jupiter.api.Test; +class ExceptionAssertionUnitTest { -public class ExceptionAssertionUnitTest { @Test - public void whenExceptionThrown_thenAssertionSucceeds() { + void whenExceptionThrown_thenAssertionSucceeds() { Exception exception = assertThrows(NumberFormatException.class, () -> { Integer.parseInt("1a"); }); @@ -19,7 +20,7 @@ public class ExceptionAssertionUnitTest { } @Test - public void whenDerivedExceptionThrown_thenAssertionSucceds() { + void whenDerivedExceptionThrown_thenAssertionSucceds() { Exception exception = assertThrows(RuntimeException.class, () -> { Integer.parseInt("1a"); }); @@ -29,4 +30,5 @@ public class ExceptionAssertionUnitTest { assertTrue(actualMessage.contains(expectedMessage)); } -} \ No newline at end of file + +}