removed System.out.println calls from tests

This commit is contained in:
Mark Fisher
2010-09-13 15:18:42 -04:00
parent 4db74cd558
commit 62f80d822b
2 changed files with 27 additions and 19 deletions

View File

@@ -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<Throwable>{
public org.springframework.integration.Message<?> toMessage(
Throwable t) throws Exception {
public static class SampleErrorMessageMapper implements InboundMessageMapper<Throwable> {
public org.springframework.integration.Message<?> toMessage(Throwable t) throws Exception {
return MessageBuilder.withPayload(t.getCause().getMessage()).build();
}
}
}

View File

@@ -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));
}