diff --git a/src/test/java/teetime/framework/ExceptionHandling.java b/src/test/java/teetime/framework/ExceptionHandling.java index 4029d695efa059ba6dd52c2aa7df95c6ed6d57ba..8e4681cb92fbae0de11fa139a9f765fb9413ec87 100644 --- a/src/test/java/teetime/framework/ExceptionHandling.java +++ b/src/test/java/teetime/framework/ExceptionHandling.java @@ -10,8 +10,8 @@ import teetime.framework.exceptionHandling.TestListener; public class ExceptionHandling { - Class<TestListener> listener; - Analysis analysis; + private Class<TestListener> listener; + private Analysis analysis; @Before public void newInstances() { @@ -19,16 +19,9 @@ public class ExceptionHandling { analysis = new Analysis(new ExceptionTestConfiguration(), listener); } - @Test(timeout = 5000) + @Test(timeout = 5000, expected = RuntimeException.class) public void exceptionPassingAndTermination() { - boolean exceptionByExecute = false; - - try { - analysis.execute(); - } catch (RuntimeException e) { - exceptionByExecute = true; - } - assertTrue(exceptionByExecute); // thread was killed + analysis.execute(); assertEquals(TestListener.exceptionInvoked, 2); // listener did not kill thread to early }