From cfb1ed1009bebe7d7fbb10908dbdbf3bae934548 Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Sun, 12 Aug 2018 15:54:38 +0200 Subject: [PATCH] Clean up warnings and delete dead code --- ...tationDrivenBeanDefinitionParserTests.java | 2 ++ .../ValidatorFactoryTests.java | 1 - ...mpAnnotationMethodMessageHandlerTests.java | 20 ++++++++++--------- ...rEntityManagerFactoryIntegrationTests.java | 2 +- ...tEntityManagerFactoryIntegrationTests.java | 1 - ...eEntityManagerFactoryIntegrationTests.java | 2 +- .../oxm/AbstractUnmarshallerTests.java | 4 ++-- .../http/ResponseCookieTests.java | 5 +---- .../FormHttpMessageConverterTests.java | 1 - .../UrlBasedCorsConfigurationSourceTests.java | 1 - .../web/util/UriComponentsTests.java | 4 ---- .../web/reactive/DispatcherHandler.java | 4 ---- .../function/BodyExtractorsTests.java | 1 - .../client/DefaultWebClientTests.java | 1 - .../support/ClientResponseWrapperTests.java | 1 + .../support/ServerRequestWrapperTests.java | 1 + ...erverWebExchangeArgumentResolverTests.java | 1 - .../ScriptTemplateWithBindingsExtensions.kt | 2 +- ...ResponseBodyEmitterReturnValueHandler.java | 6 ------ .../XmlWebApplicationContextTests.java | 1 + .../RequestMappingHandlerAdapterTests.java | 20 ------------------- ...questResponseBodyMethodProcessorTests.java | 1 + .../ScriptTemplateWithBindingsExtensions.kt | 2 +- .../MessageBrokerBeanDefinitionParser.java | 1 + .../HttpReceivingTransportHandlerTests.java | 1 - 25 files changed, 25 insertions(+), 61 deletions(-) diff --git a/spring-aspects/src/test/java/org/springframework/scheduling/aspectj/AnnotationDrivenBeanDefinitionParserTests.java b/spring-aspects/src/test/java/org/springframework/scheduling/aspectj/AnnotationDrivenBeanDefinitionParserTests.java index c0f2ee8b1d0..a40a766dee0 100644 --- a/spring-aspects/src/test/java/org/springframework/scheduling/aspectj/AnnotationDrivenBeanDefinitionParserTests.java +++ b/spring-aspects/src/test/java/org/springframework/scheduling/aspectj/AnnotationDrivenBeanDefinitionParserTests.java @@ -55,6 +55,7 @@ public class AnnotationDrivenBeanDefinitionParserTests { } @Test + @SuppressWarnings("rawtypes") public void asyncPostProcessorExecutorReference() { Object executor = context.getBean("testExecutor"); Object aspect = context.getBean(TaskManagementConfigUtils.ASYNC_EXECUTION_ASPECT_BEAN_NAME); @@ -62,6 +63,7 @@ public class AnnotationDrivenBeanDefinitionParserTests { } @Test + @SuppressWarnings("rawtypes") public void asyncPostProcessorExceptionHandlerReference() { Object exceptionHandler = context.getBean("testExceptionHandler"); Object aspect = context.getBean(TaskManagementConfigUtils.ASYNC_EXECUTION_ASPECT_BEAN_NAME); diff --git a/spring-context-support/src/test/java/org/springframework/validation/beanvalidation2/ValidatorFactoryTests.java b/spring-context-support/src/test/java/org/springframework/validation/beanvalidation2/ValidatorFactoryTests.java index 2e66afde81d..bc4aa2a2fdb 100644 --- a/spring-context-support/src/test/java/org/springframework/validation/beanvalidation2/ValidatorFactoryTests.java +++ b/spring-context-support/src/test/java/org/springframework/validation/beanvalidation2/ValidatorFactoryTests.java @@ -284,7 +284,6 @@ public class ValidatorFactoryTests { errors.initConversion(new DefaultConversionService()); validator.validate(listContainer, errors); - FieldError fieldError = errors.getFieldError("list[1]"); assertEquals("X", errors.getFieldValue("list[1]")); } diff --git a/spring-messaging/src/test/java/org/springframework/messaging/simp/annotation/support/SimpAnnotationMethodMessageHandlerTests.java b/spring-messaging/src/test/java/org/springframework/messaging/simp/annotation/support/SimpAnnotationMethodMessageHandlerTests.java index 3118a451987..05cd6b5ce8c 100644 --- a/spring-messaging/src/test/java/org/springframework/messaging/simp/annotation/support/SimpAnnotationMethodMessageHandlerTests.java +++ b/spring-messaging/src/test/java/org/springframework/messaging/simp/annotation/support/SimpAnnotationMethodMessageHandlerTests.java @@ -42,7 +42,6 @@ import org.springframework.lang.Nullable; import org.springframework.messaging.Message; import org.springframework.messaging.MessageChannel; import org.springframework.messaging.MessageHeaders; -import org.springframework.messaging.MessagingException; import org.springframework.messaging.SubscribableChannel; import org.springframework.messaging.converter.MessageConverter; import org.springframework.messaging.handler.HandlerMethod; @@ -267,9 +266,9 @@ public class SimpAnnotationMethodMessageHandlerTests { } @Test - @SuppressWarnings("unchecked") + @SuppressWarnings({ "unchecked", "rawtypes" }) public void listenableFutureSuccess() { - Message emptyMessage = (Message) MessageBuilder.withPayload(new byte[0]).build(); + Message emptyMessage = MessageBuilder.withPayload(new byte[0]).build(); given(this.channel.send(any(Message.class))).willReturn(true); given(this.converter.toMessage(any(), any(MessageHeaders.class))).willReturn(emptyMessage); @@ -287,9 +286,9 @@ public class SimpAnnotationMethodMessageHandlerTests { } @Test - @SuppressWarnings("unchecked") + @SuppressWarnings({ "unchecked", "rawtypes" }) public void listenableFutureFailure() { - Message emptyMessage = (Message) MessageBuilder.withPayload(new byte[0]).build(); + Message emptyMessage = MessageBuilder.withPayload(new byte[0]).build(); given(this.channel.send(any(Message.class))).willReturn(true); given(this.converter.toMessage(any(), any(MessageHeaders.class))).willReturn(emptyMessage); @@ -305,9 +304,9 @@ public class SimpAnnotationMethodMessageHandlerTests { } @Test - @SuppressWarnings("unchecked") + @SuppressWarnings({ "unchecked", "rawtypes" }) public void completableFutureSuccess() { - Message emptyMessage = (Message) MessageBuilder.withPayload(new byte[0]).build(); + Message emptyMessage = MessageBuilder.withPayload(new byte[0]).build(); given(this.channel.send(any(Message.class))).willReturn(true); given(this.converter.toMessage(any(), any(MessageHeaders.class))).willReturn(emptyMessage); @@ -325,9 +324,9 @@ public class SimpAnnotationMethodMessageHandlerTests { } @Test - @SuppressWarnings("unchecked") + @SuppressWarnings({ "unchecked", "rawtypes" }) public void completableFutureFailure() { - Message emptyMessage = (Message) MessageBuilder.withPayload(new byte[0]).build(); + Message emptyMessage = MessageBuilder.withPayload(new byte[0]).build(); given(this.channel.send(any(Message.class))).willReturn(true); given(this.converter.toMessage(any(), any(MessageHeaders.class))).willReturn(emptyMessage); @@ -343,6 +342,7 @@ public class SimpAnnotationMethodMessageHandlerTests { } @Test + @SuppressWarnings({ "unchecked", "rawtypes" }) public void monoSuccess() { Message emptyMessage = MessageBuilder.withPayload(new byte[0]).build(); given(this.channel.send(any(Message.class))).willReturn(true); @@ -362,6 +362,7 @@ public class SimpAnnotationMethodMessageHandlerTests { } @Test + @SuppressWarnings({ "unchecked", "rawtypes" }) public void monoFailure() { Message emptyMessage = MessageBuilder.withPayload(new byte[0]).build(); given(this.channel.send(any(Message.class))).willReturn(true); @@ -379,6 +380,7 @@ public class SimpAnnotationMethodMessageHandlerTests { } @Test + @SuppressWarnings({ "unchecked", "rawtypes" }) public void fluxNotHandled() { Message emptyMessage = MessageBuilder.withPayload(new byte[0]).build(); given(this.channel.send(any(Message.class))).willReturn(true); diff --git a/spring-orm/src/test/java/org/springframework/orm/jpa/AbstractContainerEntityManagerFactoryIntegrationTests.java b/spring-orm/src/test/java/org/springframework/orm/jpa/AbstractContainerEntityManagerFactoryIntegrationTests.java index 6c74ded9627..a3bbfbc51a8 100644 --- a/spring-orm/src/test/java/org/springframework/orm/jpa/AbstractContainerEntityManagerFactoryIntegrationTests.java +++ b/spring-orm/src/test/java/org/springframework/orm/jpa/AbstractContainerEntityManagerFactoryIntegrationTests.java @@ -81,7 +81,7 @@ public abstract class AbstractContainerEntityManagerFactoryIntegrationTests public void testEntityManagerProxyIsProxy() { assertTrue(Proxy.isProxyClass(sharedEntityManager.getClass())); Query q = sharedEntityManager.createQuery("select p from Person as p"); - List people = q.getResultList(); + q.getResultList(); assertTrue("Should be open to start with", sharedEntityManager.isOpen()); sharedEntityManager.close(); diff --git a/spring-orm/src/test/java/org/springframework/orm/jpa/AbstractEntityManagerFactoryIntegrationTests.java b/spring-orm/src/test/java/org/springframework/orm/jpa/AbstractEntityManagerFactoryIntegrationTests.java index acab5b0c570..7526eb72de9 100644 --- a/spring-orm/src/test/java/org/springframework/orm/jpa/AbstractEntityManagerFactoryIntegrationTests.java +++ b/spring-orm/src/test/java/org/springframework/orm/jpa/AbstractEntityManagerFactoryIntegrationTests.java @@ -33,7 +33,6 @@ import org.springframework.dao.DataAccessException; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator; import org.springframework.transaction.PlatformTransactionManager; -import org.springframework.transaction.TransactionDefinition; import org.springframework.transaction.TransactionException; import org.springframework.transaction.TransactionStatus; import org.springframework.transaction.support.DefaultTransactionDefinition; diff --git a/spring-orm/src/test/java/org/springframework/orm/jpa/hibernate/HibernateNativeEntityManagerFactoryIntegrationTests.java b/spring-orm/src/test/java/org/springframework/orm/jpa/hibernate/HibernateNativeEntityManagerFactoryIntegrationTests.java index bd80f31e095..9aabcfce95c 100644 --- a/spring-orm/src/test/java/org/springframework/orm/jpa/hibernate/HibernateNativeEntityManagerFactoryIntegrationTests.java +++ b/spring-orm/src/test/java/org/springframework/orm/jpa/hibernate/HibernateNativeEntityManagerFactoryIntegrationTests.java @@ -71,7 +71,7 @@ public class HibernateNativeEntityManagerFactoryIntegrationTests extends Abstrac } @Test - @SuppressWarnings("unchecked") + @SuppressWarnings({ "unchecked", "rawtypes" }) public void testCurrentSession() { String firstName = "Tony"; insertPerson(firstName); diff --git a/spring-oxm/src/test/java/org/springframework/oxm/AbstractUnmarshallerTests.java b/spring-oxm/src/test/java/org/springframework/oxm/AbstractUnmarshallerTests.java index 1bafa7984d6..a02f8e7300c 100644 --- a/spring-oxm/src/test/java/org/springframework/oxm/AbstractUnmarshallerTests.java +++ b/spring-oxm/src/test/java/org/springframework/oxm/AbstractUnmarshallerTests.java @@ -37,7 +37,6 @@ import org.w3c.dom.Element; import org.w3c.dom.Text; import org.xml.sax.InputSource; import org.xml.sax.XMLReader; -import org.xml.sax.helpers.XMLReaderFactory; import org.springframework.util.xml.StaxUtils; @@ -98,8 +97,9 @@ public abstract class AbstractUnmarshallerTests { } @Test + @SuppressWarnings("deprecation") public void unmarshalSAXSource() throws Exception { - XMLReader reader = XMLReaderFactory.createXMLReader(); + XMLReader reader = org.xml.sax.helpers.XMLReaderFactory.createXMLReader(); SAXSource source = new SAXSource(reader, new InputSource(new StringReader(INPUT_STRING))); Object flights = unmarshaller.unmarshal(source); testFlights(flights); diff --git a/spring-web/src/test/java/org/springframework/http/ResponseCookieTests.java b/spring-web/src/test/java/org/springframework/http/ResponseCookieTests.java index 41ef9edc3f1..0f71d2854f5 100644 --- a/spring-web/src/test/java/org/springframework/http/ResponseCookieTests.java +++ b/spring-web/src/test/java/org/springframework/http/ResponseCookieTests.java @@ -13,13 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.http; import java.time.Duration; -import java.time.Instant; -import java.time.ZoneId; -import java.time.ZonedDateTime; -import java.time.format.DateTimeFormatter; import org.junit.Test; diff --git a/spring-web/src/test/java/org/springframework/http/converter/FormHttpMessageConverterTests.java b/spring-web/src/test/java/org/springframework/http/converter/FormHttpMessageConverterTests.java index ceaf639cb5c..677fdc2f3bb 100644 --- a/spring-web/src/test/java/org/springframework/http/converter/FormHttpMessageConverterTests.java +++ b/spring-web/src/test/java/org/springframework/http/converter/FormHttpMessageConverterTests.java @@ -30,7 +30,6 @@ import org.apache.commons.fileupload.FileItemFactory; import org.apache.commons.fileupload.FileUpload; import org.apache.commons.fileupload.RequestContext; import org.apache.commons.fileupload.disk.DiskFileItemFactory; -import org.hamcrest.CoreMatchers; import org.hamcrest.Matchers; import org.junit.Test; diff --git a/spring-web/src/test/java/org/springframework/web/cors/reactive/UrlBasedCorsConfigurationSourceTests.java b/spring-web/src/test/java/org/springframework/web/cors/reactive/UrlBasedCorsConfigurationSourceTests.java index 137e567ea28..fa953dc4a23 100644 --- a/spring-web/src/test/java/org/springframework/web/cors/reactive/UrlBasedCorsConfigurationSourceTests.java +++ b/spring-web/src/test/java/org/springframework/web/cors/reactive/UrlBasedCorsConfigurationSourceTests.java @@ -21,7 +21,6 @@ import org.junit.Test; import org.springframework.mock.http.server.reactive.test.MockServerHttpRequest; import org.springframework.mock.web.test.server.MockServerWebExchange; import org.springframework.web.cors.CorsConfiguration; -import org.springframework.web.util.pattern.PathPatternParser; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; diff --git a/spring-web/src/test/java/org/springframework/web/util/UriComponentsTests.java b/spring-web/src/test/java/org/springframework/web/util/UriComponentsTests.java index 480b18e8651..1fd87a5856f 100644 --- a/spring-web/src/test/java/org/springframework/web/util/UriComponentsTests.java +++ b/spring-web/src/test/java/org/springframework/web/util/UriComponentsTests.java @@ -24,13 +24,9 @@ import java.net.URI; import java.net.URISyntaxException; import java.util.Arrays; import java.util.Collections; -import java.util.HashMap; -import java.util.Map; import org.junit.Test; -import org.springframework.web.util.UriComponents.UriTemplateVariables; - import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.instanceOf; import static org.hamcrest.Matchers.not; diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/DispatcherHandler.java b/spring-webflux/src/main/java/org/springframework/web/reactive/DispatcherHandler.java index e0789f0b917..86d3862b92b 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/DispatcherHandler.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/DispatcherHandler.java @@ -21,8 +21,6 @@ import java.util.Collections; import java.util.List; import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -74,8 +72,6 @@ public class DispatcherHandler implements WebHandler, ApplicationContextAware { new ResponseStatusException(HttpStatus.NOT_FOUND, "No matching handler"); - private static final Log logger = LogFactory.getLog(DispatcherHandler.class); - @Nullable private List handlerMappings; diff --git a/spring-webflux/src/test/java/org/springframework/web/reactive/function/BodyExtractorsTests.java b/spring-webflux/src/test/java/org/springframework/web/reactive/function/BodyExtractorsTests.java index 8439155701c..3f3c7767a09 100644 --- a/spring-webflux/src/test/java/org/springframework/web/reactive/function/BodyExtractorsTests.java +++ b/spring-webflux/src/test/java/org/springframework/web/reactive/function/BodyExtractorsTests.java @@ -65,7 +65,6 @@ import org.springframework.mock.http.server.reactive.test.MockServerHttpRequest; import org.springframework.util.MultiValueMap; import static org.junit.Assert.*; -import static org.mockito.Mockito.when; import static org.springframework.http.codec.json.Jackson2CodecSupport.*; /** diff --git a/spring-webflux/src/test/java/org/springframework/web/reactive/function/client/DefaultWebClientTests.java b/spring-webflux/src/test/java/org/springframework/web/reactive/function/client/DefaultWebClientTests.java index 593412c3d6f..ab8997f04a1 100644 --- a/spring-webflux/src/test/java/org/springframework/web/reactive/function/client/DefaultWebClientTests.java +++ b/spring-webflux/src/test/java/org/springframework/web/reactive/function/client/DefaultWebClientTests.java @@ -30,7 +30,6 @@ import org.mockito.MockitoAnnotations; import reactor.core.publisher.Mono; import reactor.test.StepVerifier; -import org.springframework.core.NamedInheritableThreadLocal; import org.springframework.core.NamedThreadLocal; import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; diff --git a/spring-webflux/src/test/java/org/springframework/web/reactive/function/client/support/ClientResponseWrapperTests.java b/spring-webflux/src/test/java/org/springframework/web/reactive/function/client/support/ClientResponseWrapperTests.java index fb9ba5dbf0f..1d9376622cb 100644 --- a/spring-webflux/src/test/java/org/springframework/web/reactive/function/client/support/ClientResponseWrapperTests.java +++ b/spring-webflux/src/test/java/org/springframework/web/reactive/function/client/support/ClientResponseWrapperTests.java @@ -82,6 +82,7 @@ public class ClientResponseWrapperTests { } @Test + @SuppressWarnings("unchecked") public void cookies() { MultiValueMap cookies = mock(MultiValueMap.class); when(mockResponse.cookies()).thenReturn(cookies); diff --git a/spring-webflux/src/test/java/org/springframework/web/reactive/function/server/support/ServerRequestWrapperTests.java b/spring-webflux/src/test/java/org/springframework/web/reactive/function/server/support/ServerRequestWrapperTests.java index bb567c16be2..303607b3c93 100644 --- a/spring-webflux/src/test/java/org/springframework/web/reactive/function/server/support/ServerRequestWrapperTests.java +++ b/spring-webflux/src/test/java/org/springframework/web/reactive/function/server/support/ServerRequestWrapperTests.java @@ -136,6 +136,7 @@ public class ServerRequestWrapperTests { } @Test + @SuppressWarnings("unchecked") public void cookies() { MultiValueMap cookies = mock(MultiValueMap.class); when(mockRequest.cookies()).thenReturn(cookies); diff --git a/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/ServerWebExchangeArgumentResolverTests.java b/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/ServerWebExchangeArgumentResolverTests.java index 6cb3a8e1ed9..fda786fa19a 100644 --- a/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/ServerWebExchangeArgumentResolverTests.java +++ b/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/ServerWebExchangeArgumentResolverTests.java @@ -20,7 +20,6 @@ import java.time.ZoneId; import java.util.Locale; import java.util.TimeZone; -import org.junit.Before; import org.junit.Test; import reactor.core.publisher.Mono; diff --git a/spring-webflux/src/test/kotlin/org/springframework/web/reactive/result/view/script/ScriptTemplateWithBindingsExtensions.kt b/spring-webflux/src/test/kotlin/org/springframework/web/reactive/result/view/script/ScriptTemplateWithBindingsExtensions.kt index 2467b0c719c..71722453a78 100644 --- a/spring-webflux/src/test/kotlin/org/springframework/web/reactive/result/view/script/ScriptTemplateWithBindingsExtensions.kt +++ b/spring-webflux/src/test/kotlin/org/springframework/web/reactive/result/view/script/ScriptTemplateWithBindingsExtensions.kt @@ -13,4 +13,4 @@ fun ScriptTemplateWithBindings.i18n(code: String) = var ScriptTemplateWithBindings.foo: String get() = bindings["foo"] as String - set(value) { throw UnsupportedOperationException() } + set(@Suppress("UNUSED_PARAMETER") value) { throw UnsupportedOperationException() } diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ResponseBodyEmitterReturnValueHandler.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ResponseBodyEmitterReturnValueHandler.java index e707d94d1f7..a8862293558 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ResponseBodyEmitterReturnValueHandler.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ResponseBodyEmitterReturnValueHandler.java @@ -23,9 +23,6 @@ import java.util.function.Consumer; import javax.servlet.ServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - import org.springframework.core.MethodParameter; import org.springframework.core.ReactiveAdapterRegistry; import org.springframework.core.ResolvableType; @@ -60,9 +57,6 @@ import org.springframework.web.method.support.ModelAndViewContainer; */ public class ResponseBodyEmitterReturnValueHandler implements HandlerMethodReturnValueHandler { - private static final Log logger = LogFactory.getLog(ResponseBodyEmitterReturnValueHandler.class); - - private final List> messageConverters; private final ReactiveTypeHandler reactiveHandler; diff --git a/spring-webmvc/src/test/java/org/springframework/web/context/XmlWebApplicationContextTests.java b/spring-webmvc/src/test/java/org/springframework/web/context/XmlWebApplicationContextTests.java index e2d1853818b..194e71f198a 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/context/XmlWebApplicationContextTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/context/XmlWebApplicationContextTests.java @@ -85,6 +85,7 @@ public class XmlWebApplicationContextTests extends AbstractApplicationContextTes } @Test + @SuppressWarnings("deprecation") public void environmentMerge() { assertThat(this.root.getEnvironment().acceptsProfiles("rootProfile1"), is(true)); assertThat(this.root.getEnvironment().acceptsProfiles("wacProfile1"), is(false)); diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerAdapterTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerAdapterTests.java index 7b357d71183..776ccdd60a6 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerAdapterTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerAdapterTests.java @@ -265,26 +265,6 @@ public class RequestMappingHandlerAdapterTests { assertEquals(handlerCount, this.handlerAdapter.getReturnValueHandlers().size()); } - private void testJsonp(String value, boolean validValue) throws Exception { - - this.request = new MockHttpServletRequest("GET", "/"); - this.request.addHeader("Accept", MediaType.APPLICATION_JSON_VALUE); - this.request.setParameter("c", value); - this.response = new MockHttpServletResponse(); - - HandlerMethod handlerMethod = handlerMethod(new SimpleController(), "handleWithResponseEntity"); - this.handlerAdapter.afterPropertiesSet(); - this.handlerAdapter.handle(this.request, this.response, handlerMethod); - - assertEquals(200, this.response.getStatus()); - if (validValue) { - assertEquals("/**/" + value + "({\"foo\":\"bar\"});", this.response.getContentAsString()); - } - else { - assertEquals("{\"foo\":\"bar\"}", this.response.getContentAsString()); - } - } - @SuppressWarnings("unused") private static class SimpleController { diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/RequestResponseBodyMethodProcessorTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/RequestResponseBodyMethodProcessorTests.java index 1de18f5f7d1..df1b1862134 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/RequestResponseBodyMethodProcessorTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/RequestResponseBodyMethodProcessorTests.java @@ -936,6 +936,7 @@ public class RequestResponseBodyMethodProcessorTests { @RequestMapping @ResponseBody + @SuppressWarnings("unchecked") public List handleTypeInfoList() { List list = new ArrayList<>(); list.add((T) new Foo("foo")); diff --git a/spring-webmvc/src/test/kotlin/org/springframework/web/servlet/view/script/ScriptTemplateWithBindingsExtensions.kt b/spring-webmvc/src/test/kotlin/org/springframework/web/servlet/view/script/ScriptTemplateWithBindingsExtensions.kt index 7aed88b5eef..4dd36838af5 100644 --- a/spring-webmvc/src/test/kotlin/org/springframework/web/servlet/view/script/ScriptTemplateWithBindingsExtensions.kt +++ b/spring-webmvc/src/test/kotlin/org/springframework/web/servlet/view/script/ScriptTemplateWithBindingsExtensions.kt @@ -13,4 +13,4 @@ fun ScriptTemplateWithBindings.i18n(code: String) = var ScriptTemplateWithBindings.foo: String get() = bindings["foo"] as String - set(value) { throw UnsupportedOperationException()} + set(@Suppress("UNUSED_PARAMETER") value) { throw UnsupportedOperationException()} diff --git a/spring-websocket/src/main/java/org/springframework/web/socket/config/MessageBrokerBeanDefinitionParser.java b/spring-websocket/src/main/java/org/springframework/web/socket/config/MessageBrokerBeanDefinitionParser.java index d336e661316..6ac6777a136 100644 --- a/spring-websocket/src/main/java/org/springframework/web/socket/config/MessageBrokerBeanDefinitionParser.java +++ b/spring-websocket/src/main/java/org/springframework/web/socket/config/MessageBrokerBeanDefinitionParser.java @@ -679,6 +679,7 @@ class MessageBrokerBeanDefinitionParser implements BeanDefinitionParser { private final List factories; + @SuppressWarnings("unused") public DecoratingFactoryBean(WebSocketHandler handler, List factories) { this.handler = handler; this.factories = factories; diff --git a/spring-websocket/src/test/java/org/springframework/web/socket/sockjs/transport/handler/HttpReceivingTransportHandlerTests.java b/spring-websocket/src/test/java/org/springframework/web/socket/sockjs/transport/handler/HttpReceivingTransportHandlerTests.java index 72d77810e4d..7c29114a39f 100644 --- a/spring-websocket/src/test/java/org/springframework/web/socket/sockjs/transport/handler/HttpReceivingTransportHandlerTests.java +++ b/spring-websocket/src/test/java/org/springframework/web/socket/sockjs/transport/handler/HttpReceivingTransportHandlerTests.java @@ -18,7 +18,6 @@ package org.springframework.web.socket.sockjs.transport.handler; import org.junit.Test; -import org.springframework.http.MediaType; import org.springframework.web.socket.AbstractHttpRequestTests; import org.springframework.web.socket.TextMessage; import org.springframework.web.socket.WebSocketHandler;