diff --git a/src/test/java/teetime/framework/exceptionHandling/ExceptionHandlingTest.java b/src/test/java/teetime/framework/exceptionHandling/ExceptionHandlingTest.java index 1388df7075ba18bc22e86ca640da196888ecd35c..c1b1de38e023806fc8f9571a67372f677817980c 100644 --- a/src/test/java/teetime/framework/exceptionHandling/ExceptionHandlingTest.java +++ b/src/test/java/teetime/framework/exceptionHandling/ExceptionHandlingTest.java @@ -46,6 +46,18 @@ public class ExceptionHandlingTest { fail(); // Should never be executed } + @Test + public void testException() { + boolean exceptionArised = false; + ExceptionPassingTestConfig exceptionPassingTestConfig = new ExceptionPassingTestConfig(); + try { + new Execution<ExceptionPassingTestConfig>(exceptionPassingTestConfig).executeBlocking(); + } catch (ExecutionException e) { + exceptionArised = true; + } + assertTrue(exceptionArised); + } + @Ignore @Test public void forAFewTimes() { diff --git a/src/test/java/teetime/framework/exceptionHandling/ExceptionPassingTestConfig.java b/src/test/java/teetime/framework/exceptionHandling/ExceptionPassingTestConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..779809c559a1e6598fd76764781c232acc62c128 --- /dev/null +++ b/src/test/java/teetime/framework/exceptionHandling/ExceptionPassingTestConfig.java @@ -0,0 +1,21 @@ +package teetime.framework.exceptionHandling; + +import teetime.framework.AbstractConsumerStage; +import teetime.framework.Configuration; +import teetime.stage.InitialElementProducer; + +public class ExceptionPassingTestConfig extends Configuration { + + public ExceptionPassingTestConfig() { + connectPorts(new InitialElementProducer<Object>(new Object()).getOutputPort(), new ExceptionStage().getInputPort()); + } + + private class ExceptionStage extends AbstractConsumerStage<Object> { + + @Override + protected void execute(final Object element) { + throw new IllegalStateException("Correct exception"); + } + } + +}