From 037c58fc80daa36de048c905c66d77d1ab9c0c01 Mon Sep 17 00:00:00 2001
From: Nelson Tavares de Sousa <stu103017@mail.uni-kiel.de>
Date: Wed, 23 Sep 2015 15:09:57 +0200
Subject: [PATCH] added config and test to check if exception are passed on
 correctly

---
 .../ExceptionHandlingTest.java                | 12 +++++++++++
 .../ExceptionPassingTestConfig.java           | 21 +++++++++++++++++++
 2 files changed, 33 insertions(+)
 create mode 100644 src/test/java/teetime/framework/exceptionHandling/ExceptionPassingTestConfig.java

diff --git a/src/test/java/teetime/framework/exceptionHandling/ExceptionHandlingTest.java b/src/test/java/teetime/framework/exceptionHandling/ExceptionHandlingTest.java
index 1388df70..c1b1de38 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 00000000..779809c5
--- /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");
+		}
+	}
+
+}
-- 
GitLab