diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/ExceptionHandlingSiConsumerTests.java b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/ExceptionHandlingSiConsumerTests.java index ee09b2a3d6..4eddd20e73 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/ExceptionHandlingSiConsumerTests.java +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/ExceptionHandlingSiConsumerTests.java @@ -13,8 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.integration.jms.config; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + import javax.jms.ConnectionFactory; import javax.jms.Destination; import javax.jms.JMSException; @@ -22,9 +26,8 @@ import javax.jms.Message; import javax.jms.Session; import javax.jms.TextMessage; -import org.junit.Assert; -import org.junit.Ignore; import org.junit.Test; + import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.integration.mapping.InboundMessageMapper; @@ -55,10 +58,10 @@ public class ExceptionHandlingSiConsumerTests { } }); Message message = jmsTemplate.receive(reply); - System.out.println(message); - Assert.assertNotNull(message); + assertNotNull(message); applicationContext.close(); } + @Test public void nonSiProducer_siConsumer_sync_withReturnNoException() throws Exception { ActiveMqTestUtils.prepare(); @@ -76,7 +79,8 @@ public class ExceptionHandlingSiConsumerTests { } }); Message message = jmsTemplate.receive(reply); - Assert.assertNotNull(message); + assertNotNull(message); + assertEquals("echoWithException", ((TextMessage) message).getText()); applicationContext.close(); } @@ -86,35 +90,40 @@ public class ExceptionHandlingSiConsumerTests { final ConfigurableApplicationContext applicationContext = new ClassPathXmlApplicationContext("Exception-nonSiProducer-siConsumer.xml", ExceptionHandlingSiConsumerTests.class); SampleGateway gateway = applicationContext.getBean("sampleGateway", SampleGateway.class); String reply = gateway.echo("echoWithExceptionChannel"); - System.out.println("Reply: " + reply); + assertEquals("echoWithException", reply); applicationContext.close(); } -// - public static class SampleService{ - public String echoWithException(String value){ + + + public static class SampleService { + + public String echoWithException(String value) { throw new SampleException("echoWithException"); } + public String echo(String value){ return value; } } - - + + @SuppressWarnings("serial") - public static class SampleException extends RuntimeException{ + public static class SampleException extends RuntimeException { public SampleException(String message){ super(message); } } - - public static interface SampleGateway{ + + + public static interface SampleGateway { public String echo(String value); } - - public static class SampleErrorMessageMapper implements InboundMessageMapper{ - public org.springframework.integration.Message toMessage( - Throwable t) throws Exception { + + + public static class SampleErrorMessageMapper implements InboundMessageMapper { + public org.springframework.integration.Message toMessage(Throwable t) throws Exception { return MessageBuilder.withPayload(t.getCause().getMessage()).build(); } } + } diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsMessageHistoryTests.java b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsMessageHistoryTests.java index b1733a89ca..4e78ba5683 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsMessageHistoryTests.java +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsMessageHistoryTests.java @@ -58,7 +58,6 @@ public class JmsMessageHistoryTests { assertEquals("jms:inbound-channel-adapter", event1.getProperty(MessageHistory.TYPE_PROPERTY)); assertEquals("sampleJmsInboundAdapter", event1.getProperty(MessageHistory.NAME_PROPERTY)); Properties event2 = historyIterator.next(); - System.out.println(event2); assertEquals("channel", event2.getProperty(MessageHistory.TYPE_PROPERTY)); assertEquals("jmsInputChannel", event2.getProperty(MessageHistory.NAME_PROPERTY)); }