Clean up warnings in spring-messaging

This commit is contained in:
Sam Brannen
2014-09-22 14:29:21 +02:00
parent b9348bb89c
commit bf93f0c5e9
18 changed files with 15 additions and 21 deletions

View File

@@ -22,7 +22,6 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import org.junit.Before;
import org.junit.Test;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageHeaders;
@@ -42,13 +41,7 @@ import static org.junit.Assert.*;
*/
public class MessageConverterTests {
private TestMessageConverter converter;
@Before
public void setup() {
this.converter = new TestMessageConverter();
}
private TestMessageConverter converter = new TestMessageConverter();
@Test
public void supportsTargetClass() {
@@ -105,7 +98,6 @@ public class MessageConverterTests {
@Test(expected = IllegalArgumentException.class)
public void setStrictContentTypeMatchWithNoSupportedMimeTypes() {
Message<String> message = MessageBuilder.withPayload("ABC").build();
this.converter = new TestMessageConverter(Collections.<MimeType>emptyList());
this.converter.setStrictContentTypeMatch(true);
}

View File

@@ -130,6 +130,7 @@ public class MethodMessageHandlerTests {
}
@SuppressWarnings("unused")
private static class TestController {
public String method;
@@ -140,6 +141,7 @@ public class MethodMessageHandlerTests {
this.method = "pathMatchWildcard";
}
@SuppressWarnings("rawtypes")
public void handlerArgumentResolver(Message message) {
this.method = "handlerArgumentResolver";
this.arguments.put("message", message);
@@ -164,6 +166,7 @@ public class MethodMessageHandlerTests {
}
@SuppressWarnings("unused")
private static class DuplicateMappingsController {
public void handlerFoo() { }

View File

@@ -39,6 +39,7 @@ public class SimpSessionScopeTests {
private SimpSessionScope scope;
@SuppressWarnings("rawtypes")
private ObjectFactory objectFactory;
private SimpAttributes simpAttributes;

View File

@@ -78,7 +78,6 @@ public class SendToMethodReturnValueHandlerTests {
@Before
@SuppressWarnings({ "unchecked", "rawtypes" })
public void setup() throws Exception {
MockitoAnnotations.initMocks(this);

View File

@@ -87,6 +87,7 @@ public class SimpAnnotationMethodMessageHandlerTests {
@Test
@SuppressWarnings("unchecked")
public void headerArgumentResolution() {
SimpMessageHeaderAccessor headers = SimpMessageHeaderAccessor.create();
headers.setSessionId("session1");

View File

@@ -124,8 +124,8 @@ public class SubscriptionMethodReturnValueHandlerTests {
assertEquals(MIME_TYPE, headerAccessor.getContentType());
}
@SuppressWarnings("unchecked")
@Test
@SuppressWarnings({ "unchecked", "rawtypes" })
public void testHeadersPassedToMessagingTemplate() throws Exception {
String sessionId = "sess1";

View File

@@ -32,7 +32,6 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestName;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationEventPublisher;
@@ -386,6 +385,8 @@ public class StompBrokerRelayMessageHandlerIntegrationTests {
return builder;
}
// TODO Determine why connectWithError() is unused.
@SuppressWarnings("unused")
public static MessageExchangeBuilder connectWithError(String sessionId) {
StompHeaderAccessor headers = StompHeaderAccessor.create(StompCommand.CONNECT);
headers.setSessionId(sessionId);

View File

@@ -225,6 +225,8 @@ public class ExecutorSubscribableChannelTests {
this.messageToReturn = messageToReturn;
}
// TODO Determine why setExceptionToRaise() is unused.
@SuppressWarnings("unused")
public void setExceptionToRaise(RuntimeException exception) {
this.exceptionToRaise = exception;
}

View File

@@ -215,7 +215,7 @@ public class MessageBuilderTests {
@Test
public void testBuildMultipleMessages() {
MessageHeaderAccessor headerAccessor = new MessageHeaderAccessor();
MessageBuilder messageBuilder = MessageBuilder.withPayload("payload").setHeaders(headerAccessor);
MessageBuilder<?> messageBuilder = MessageBuilder.withPayload("payload").setHeaders(headerAccessor);
headerAccessor.setHeader("foo", "bar1");
Message<?> message1 = messageBuilder.build();

View File

@@ -85,7 +85,6 @@ public class NativeMessageHeaderAccessorTests {
Map<String, Object> actual = headerAccessor.toMap();
assertEquals(0, actual.size());
@SuppressWarnings("unchecked")
Map<String, List<String>> actualNativeHeaders = headerAccessor.toNativeHeaderMap();
assertEquals(Collections.emptyMap(), actualNativeHeaders);
}