Browse Source

Fix test class name and protect debug log message

pull/588/merge
Rossen Stoyanchev 11 years ago
parent
commit
f8e4547228
  1. 4
      spring-messaging/src/main/java/org/springframework/messaging/support/AbstractMessageChannel.java
  2. 18
      spring-messaging/src/test/java/org/springframework/messaging/support/ExecutorSubscribableChannelTests.java

4
spring-messaging/src/main/java/org/springframework/messaging/support/AbstractMessageChannel.java

@ -147,7 +147,9 @@ public abstract class AbstractMessageChannel implements MessageChannel, BeanName @@ -147,7 +147,9 @@ public abstract class AbstractMessageChannel implements MessageChannel, BeanName
message = interceptor.preSend(message, channel);
if (message == null) {
String name = interceptor.getClass().getSimpleName();
logger.debug(name + " returned null from preSend, i.e. precluding the send.");
if (logger.isDebugEnabled()) {
logger.debug(name + " returned null from preSend, i.e. precluding the send.");
}
triggerAfterSendCompletion(message, channel, false, null);
return null;
}

18
spring-messaging/src/test/java/org/springframework/messaging/support/PublishSubscribeChannelTests.java → spring-messaging/src/test/java/org/springframework/messaging/support/ExecutorSubscribableChannelTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -28,19 +28,17 @@ import org.springframework.core.task.TaskExecutor; @@ -28,19 +28,17 @@ import org.springframework.core.task.TaskExecutor;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageDeliveryException;
import org.springframework.messaging.MessageHandler;
import org.springframework.messaging.MessagingException;
import org.springframework.messaging.support.MessageBuilder;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
import static org.mockito.BDDMockito.*;
/**
* Tests for {@link ExecutorSubscribableChannel}.
* Unit tests for {@link ExecutorSubscribableChannel}.
*
* @author Phillip Webb
*/
public class PublishSubscribeChannelTests {
public class ExecutorSubscribableChannelTests {
@Rule
public ExpectedException thrown = ExpectedException.none();
@ -117,20 +115,14 @@ public class PublishSubscribeChannelTests { @@ -117,20 +115,14 @@ public class PublishSubscribeChannelTests {
this.channel.send(message);
}
catch (MessageDeliveryException actualException) {
assertThat((RuntimeException) actualException.getCause(), equalTo(ex));
assertThat(actualException.getCause(), equalTo(ex));
}
verifyZeroInteractions(secondHandler);
}
@Test
public void concurrentModification() throws Exception {
this.channel.subscribe(new MessageHandler() {
@Override
public void handleMessage(Message<?> message) throws MessagingException {
channel.unsubscribe(handler);
}
});
this.channel.subscribe(message1 -> channel.unsubscribe(handler));
this.channel.subscribe(this.handler);
this.channel.send(this.message);
verify(this.handler).handleMessage(this.message);
Loading…
Cancel
Save