diff --git a/src/main/java/teetime/framework/AbstractRunnableStage.java b/src/main/java/teetime/framework/AbstractRunnableStage.java index 00f4f59fe81c365007fe5ab0be363753a5f9bc2d..f5146dd584787db52481580796979fe75dc324c2 100644 --- a/src/main/java/teetime/framework/AbstractRunnableStage.java +++ b/src/main/java/teetime/framework/AbstractRunnableStage.java @@ -46,6 +46,7 @@ abstract class AbstractRunnableStage implements Runnable { } while (!stage.shouldBeTerminated()); } catch (StageException e) { this.stage.terminate(); + failed = true; } afterStageExecution(stage); @@ -66,6 +67,7 @@ abstract class AbstractRunnableStage implements Runnable { stage.onSignal(signal, inputPorts[i]); } } + System.out.println("HELLO"); throw new IllegalStateException("Terminated by StageExceptionListener"); } diff --git a/src/test/java/teetime/framework/exceptionHandling/ExceptionHandlingTest.java b/src/test/java/teetime/framework/exceptionHandling/ExceptionHandlingTest.java index 4806872bb20d1076a483d2139ffb8f46c9a259be..0b2d44c12bda0c0c2d6e024de7a7a0330b933e98 100644 --- a/src/test/java/teetime/framework/exceptionHandling/ExceptionHandlingTest.java +++ b/src/test/java/teetime/framework/exceptionHandling/ExceptionHandlingTest.java @@ -22,6 +22,7 @@ import static org.junit.Assert.assertThat; import org.junit.Test; import teetime.framework.Analysis; +import teetime.framework.AnalysisException; import teetime.framework.StageState; public class ExceptionHandlingTest { @@ -34,14 +35,12 @@ public class ExceptionHandlingTest { return configuration; } - @Test public void exceptionPassingAndTermination() { newInstances(); analysis.executeBlocking(); - assertEquals(TestListener.exceptionInvoked, 2); // listener did not kill thread to early + assertEquals(TestListener.exceptionInvoked, 2); // listener did not kill thread too early } - @Test public void terminatesAllStages() { ExceptionTestConfiguration config = newInstances(); analysis.executeBlocking(); @@ -53,8 +52,12 @@ public class ExceptionHandlingTest { @Test public void forAFewTimes() { for (int i = 0; i < 100; i++) { - newInstances(); - exceptionPassingAndTermination(); + try { + exceptionPassingAndTermination(); + terminatesAllStages(); + } catch (AnalysisException e) { + // Correct behavior + } } } }