Fixed test

Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/124dc650
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/124dc650
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/124dc650

Branch: refs/heads/master
Commit: 124dc650ff31a83d66ad582e860e526661c999cb
Parents: aaa3a0c
Author: Claus Ibsen <davscl...@apache.org>
Authored: Fri Apr 22 07:26:20 2016 +0200
Committer: Claus Ibsen <davscl...@apache.org>
Committed: Fri Apr 22 07:26:20 2016 +0200

----------------------------------------------------------------------
 .../AggregateClosedCorrelationKeyTest.java        | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/124dc650/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregateClosedCorrelationKeyTest.java
----------------------------------------------------------------------
diff --git 
a/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregateClosedCorrelationKeyTest.java
 
b/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregateClosedCorrelationKeyTest.java
index a9efbd4..0b98986 100644
--- 
a/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregateClosedCorrelationKeyTest.java
+++ 
b/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregateClosedCorrelationKeyTest.java
@@ -83,14 +83,24 @@ public class AggregateClosedCorrelationKeyTest extends 
ContextTestSupport {
         template.sendBodyAndHeader("direct:start", "E", "id", 3);
         template.sendBodyAndHeader("direct:start", "F", "id", 3);
 
+        // 2 of them should now be closed
+        int closed = 0;
+
         // should NOT be closed because only 2 and 3 is remembered as they are 
the two last used
-        template.sendBodyAndHeader("direct:start", "G", "id", 1);
+        try {
+            template.sendBodyAndHeader("direct:start", "G", "id", 1);
+        } catch (CamelExecutionException e) {
+            closed++;
+            ClosedCorrelationKeyException cause = 
assertIsInstanceOf(ClosedCorrelationKeyException.class, e.getCause());
+            assertEquals("1", cause.getCorrelationKey());
+            assertTrue(cause.getMessage().startsWith("The correlation key [1] 
has been closed."));
+        }
 
         // should be closed
         try {
             template.sendBodyAndHeader("direct:start", "H", "id", 2);
-            fail("Should throw an exception");
         } catch (CamelExecutionException e) {
+            closed++;
             ClosedCorrelationKeyException cause = 
assertIsInstanceOf(ClosedCorrelationKeyException.class, e.getCause());
             assertEquals("2", cause.getCorrelationKey());
             assertTrue(cause.getMessage().startsWith("The correlation key [2] 
has been closed."));
@@ -99,14 +109,16 @@ public class AggregateClosedCorrelationKeyTest extends 
ContextTestSupport {
         // should be closed
         try {
             template.sendBodyAndHeader("direct:start", "I", "id", 3);
-            fail("Should throw an exception");
         } catch (CamelExecutionException e) {
+            closed++;
             ClosedCorrelationKeyException cause = 
assertIsInstanceOf(ClosedCorrelationKeyException.class, e.getCause());
             assertEquals("3", cause.getCorrelationKey());
             assertTrue(cause.getMessage().startsWith("The correlation key [3] 
has been closed."));
         }
 
         assertMockEndpointsSatisfied();
+
+        assertEquals("There should be 2 closed", 2, closed);
     }
 
 }

Reply via email to