camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cmuel...@apache.org
Subject [2/4] git commit: simplified the unit test
Date Sat, 25 May 2013 16:09:09 GMT
simplified the unit test


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

Branch: refs/heads/camel-2.11.x
Commit: 91dcf0cde4c0a50f8d379781ae512c3c5ef3eba4
Parents: 4e989fa
Author: cmueller <cmueller@apache.org>
Authored: Thu May 23 23:45:21 2013 +0200
Committer: cmueller <cmueller@apache.org>
Committed: Sat May 25 18:06:20 2013 +0200

----------------------------------------------------------------------
 .../spring/batch/SpringBatchIntegrationTest.java   |   19 ++++-----------
 1 files changed, 5 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/91dcf0cd/components/camel-spring-batch/src/test/java/org/apache/camel/component/spring/batch/SpringBatchIntegrationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-batch/src/test/java/org/apache/camel/component/spring/batch/SpringBatchIntegrationTest.java
b/components/camel-spring-batch/src/test/java/org/apache/camel/component/spring/batch/SpringBatchIntegrationTest.java
index 74dc734..12e9f80 100644
--- a/components/camel-spring-batch/src/test/java/org/apache/camel/component/spring/batch/SpringBatchIntegrationTest.java
+++ b/components/camel-spring-batch/src/test/java/org/apache/camel/component/spring/batch/SpringBatchIntegrationTest.java
@@ -24,8 +24,6 @@ import org.junit.Test;
 import org.springframework.context.ApplicationContext;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
-import static org.junit.Assert.assertTrue;
-
 public class SpringBatchIntegrationTest {
 
     ApplicationContext applicationContext;
@@ -36,7 +34,7 @@ public class SpringBatchIntegrationTest {
 
     MockEndpoint jobExecutionEventsQueueEndpoint;
 
-    String[] inputMessages;
+    String[] inputMessages = new String[]{"foo", "bar", "baz", null};
 
     @Before
     public void setUp() {
@@ -44,34 +42,27 @@ public class SpringBatchIntegrationTest {
         producerTemplate = applicationContext.getBean(ProducerTemplate.class);
         outputEndpoint = applicationContext.getBean(CamelContext.class).getEndpoint("mock:output",
MockEndpoint.class);
         jobExecutionEventsQueueEndpoint = applicationContext.getBean(CamelContext.class).getEndpoint("mock:jobExecutionEventsQueue",
MockEndpoint.class);
-        inputMessages = new String[]{"foo", "bar", "baz"};
 
         for (String message : inputMessages) {
             producerTemplate.sendBody("seda:inputQueue", message);
         }
-        producerTemplate.sendBody("seda:inputQueue", null);
-
     }
 
     @Test
     public void shouldEchoInBatch() throws InterruptedException {
-        // When
+        outputEndpoint.expectedBodiesReceived("Echo foo", "Echo bar", "Echo baz");
+
         producerTemplate.sendBody("direct:start", "Start batch!");
 
-        // Then
-        outputEndpoint.setExpectedMessageCount(inputMessages.length);
         outputEndpoint.assertIsSatisfied();
-        assertTrue(outputEndpoint.getExchanges().get(0).getIn().getBody(String.class).startsWith("Echo
"));
     }
 
     @Test
     public void shouldGenerateBatchExecutionEvents() throws InterruptedException {
-        // When
+        jobExecutionEventsQueueEndpoint.setExpectedMessageCount(2);
+
         producerTemplate.sendBody("direct:start", "Start batch!");
 
-        // Then
-        jobExecutionEventsQueueEndpoint.setExpectedMessageCount(2);
         jobExecutionEventsQueueEndpoint.assertIsSatisfied();
     }
-
 }


Mime
View raw message