Browse Source

Fix failing test and warings

The test failure was caused by the previous commit. The Message
resolver now supports payload conversion so it can raise a
MessageConversionException, not MethodArgumentTypeMismatchException.
pull/973/head
Rossen Stoyanchev 9 years ago
parent
commit
f33578ef0f
  1. 16
      spring-jms/src/test/java/org/springframework/jms/config/MethodJmsListenerEndpointTests.java

16
spring-jms/src/test/java/org/springframework/jms/config/MethodJmsListenerEndpointTests.java

@ -57,14 +57,18 @@ import org.springframework.messaging.handler.annotation.Headers; @@ -57,14 +57,18 @@ import org.springframework.messaging.handler.annotation.Headers;
import org.springframework.messaging.handler.annotation.Payload;
import org.springframework.messaging.handler.annotation.SendTo;
import org.springframework.messaging.handler.annotation.support.DefaultMessageHandlerMethodFactory;
import org.springframework.messaging.handler.annotation.support.MethodArgumentTypeMismatchException;
import org.springframework.util.ReflectionUtils;
import org.springframework.validation.Errors;
import org.springframework.validation.Validator;
import org.springframework.validation.annotation.Validated;
import static org.junit.Assert.*;
import static org.mockito.BDDMockito.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.mockito.BDDMockito.given;
import static org.mockito.BDDMockito.mock;
import static org.mockito.BDDMockito.verify;
/**
* @author Stephane Nicoll
@ -407,7 +411,7 @@ public class MethodJmsListenerEndpointTests { @@ -407,7 +411,7 @@ public class MethodJmsListenerEndpointTests {
Session session = mock(Session.class);
thrown.expect(ListenerExecutionFailedException.class);
thrown.expectCause(Matchers.isA(MethodArgumentTypeMismatchException.class));
thrown.expectCause(Matchers.isA(MessageConversionException.class));
listener.onMessage(createSimpleJmsTextMessage("test"), session); // Message<String> as Message<Integer>
}
@ -478,10 +482,10 @@ public class MethodJmsListenerEndpointTests { @@ -478,10 +482,10 @@ public class MethodJmsListenerEndpointTests {
}
@SendTo("defaultReply")
@SendTo("defaultReply") @SuppressWarnings("unused")
static class JmsEndpointSampleBean {
private final Map<String, Boolean> invocations = new HashMap<String, Boolean>();
private final Map<String, Boolean> invocations = new HashMap<>();
public void resolveMessageAndSession(javax.jms.Message message, Session session) {
invocations.put("resolveMessageAndSession", true);

Loading…
Cancel
Save