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