diff --git a/core-java/src/test/java/com/baeldung/sneakythrows/SneakyRunnableTest.java b/core-java/src/test/java/com/baeldung/sneakythrows/SneakyRunnableTest.java index cd31f545b9..794e70d475 100644 --- a/core-java/src/test/java/com/baeldung/sneakythrows/SneakyRunnableTest.java +++ b/core-java/src/test/java/com/baeldung/sneakythrows/SneakyRunnableTest.java @@ -6,12 +6,8 @@ import static junit.framework.TestCase.assertEquals; public class SneakyRunnableTest { - @Test + @Test(expected = InterruptedException.class) public void whenCallSneakyRunnableMethod_thenThrowException() { - try { - new SneakyRunnable().run(); - } catch (Exception e) { - assertEquals(InterruptedException.class, e.getStackTrace()); - } + new SneakyRunnable().run(); } }