Clean up warnings and delete dead code
This commit is contained in:
parent
c4a7567a5e
commit
cfb1ed1009
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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]"));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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<Person> people = q.getResultList();
|
||||
q.getResultList();
|
||||
|
||||
assertTrue("Should be open to start with", sharedEntityManager.isOpen());
|
||||
sharedEntityManager.close();
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ public class HibernateNativeEntityManagerFactoryIntegrationTests extends Abstrac
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void testCurrentSession() {
|
||||
String firstName = "Tony";
|
||||
insertPerson(firstName);
|
||||
|
|
|
|||
|
|
@ -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<U extends Unmarshaller> {
|
|||
}
|
||||
|
||||
@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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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<HandlerMapping> handlerMappings;
|
||||
|
||||
|
|
|
|||
|
|
@ -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.*;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -82,6 +82,7 @@ public class ClientResponseWrapperTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void cookies() {
|
||||
MultiValueMap<String, ResponseCookie> cookies = mock(MultiValueMap.class);
|
||||
when(mockResponse.cookies()).thenReturn(cookies);
|
||||
|
|
|
|||
|
|
@ -136,6 +136,7 @@ public class ServerRequestWrapperTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void cookies() {
|
||||
MultiValueMap<String, HttpCookie> cookies = mock(MultiValueMap.class);
|
||||
when(mockRequest.cookies()).thenReturn(cookies);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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() }
|
||||
|
|
|
|||
|
|
@ -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<HttpMessageConverter<?>> messageConverters;
|
||||
|
||||
private final ReactiveTypeHandler reactiveHandler;
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -936,6 +936,7 @@ public class RequestResponseBodyMethodProcessorTests {
|
|||
|
||||
@RequestMapping
|
||||
@ResponseBody
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<T> handleTypeInfoList() {
|
||||
List<T> list = new ArrayList<>();
|
||||
list.add((T) new Foo("foo"));
|
||||
|
|
|
|||
|
|
@ -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()}
|
||||
|
|
|
|||
|
|
@ -679,6 +679,7 @@ class MessageBrokerBeanDefinitionParser implements BeanDefinitionParser {
|
|||
|
||||
private final List<WebSocketHandlerDecoratorFactory> factories;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public DecoratingFactoryBean(WebSocketHandler handler, List<WebSocketHandlerDecoratorFactory> factories) {
|
||||
this.handler = handler;
|
||||
this.factories = factories;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue