Clean up imports and warnings
This commit is contained in:
@@ -23,6 +23,11 @@ import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.beans.FatalBeanException;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
@@ -45,17 +50,8 @@ import com.fasterxml.jackson.databind.ser.Serializers;
|
||||
import com.fasterxml.jackson.databind.ser.std.ClassSerializer;
|
||||
import com.fasterxml.jackson.databind.ser.std.NumberSerializers.NumberSerializer;
|
||||
import com.fasterxml.jackson.databind.type.SimpleType;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.beans.FatalBeanException;
|
||||
|
||||
import static junit.framework.Assert.assertTrue;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertSame;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Test cases for {@link Jackson2ObjectMapperFactoryBean} class.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 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.
|
||||
@@ -36,7 +36,6 @@ import org.springframework.core.ParameterizedTypeReference;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.http.MockHttpInputMessage;
|
||||
import org.springframework.http.converter.HttpMessageConverter;
|
||||
|
||||
/**
|
||||
* Test fixture for {@link Jaxb2CollectionHttpMessageConverter}.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 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.
|
||||
@@ -18,16 +18,13 @@ package org.springframework.http.converter.xml;
|
||||
|
||||
import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.Assert.assertNotEquals;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.StringReader;
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.stream.XMLStreamException;
|
||||
import javax.xml.stream.XMLStreamReader;
|
||||
import javax.xml.transform.Source;
|
||||
import javax.xml.transform.dom.DOMSource;
|
||||
@@ -44,8 +41,10 @@ import org.springframework.http.MediaType;
|
||||
import org.springframework.http.MockHttpInputMessage;
|
||||
import org.springframework.http.MockHttpOutputMessage;
|
||||
import org.springframework.util.FileCopyUtils;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.XMLReader;
|
||||
@@ -162,7 +161,6 @@ public class SourceHttpMessageConverterTests {
|
||||
streamReader.close();
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void readStreamSource() throws Exception {
|
||||
MockHttpInputMessage inputMessage = new MockHttpInputMessage(BODY.getBytes("UTF-8"));
|
||||
|
||||
@@ -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.
|
||||
@@ -19,6 +19,7 @@ package org.springframework.web.client;
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.GenericServlet;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.ServletRequest;
|
||||
@@ -32,18 +33,23 @@ import org.apache.commons.fileupload.FileItemFactory;
|
||||
import org.apache.commons.fileupload.FileUploadException;
|
||||
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
|
||||
import org.apache.commons.fileupload.servlet.ServletFileUpload;
|
||||
|
||||
import org.eclipse.jetty.server.Server;
|
||||
import org.eclipse.jetty.servlet.ServletContextHandler;
|
||||
import org.eclipse.jetty.servlet.ServletHolder;
|
||||
|
||||
import org.junit.AfterClass;
|
||||
import static org.junit.Assert.*;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.util.FileCopyUtils;
|
||||
import org.springframework.util.SocketUtils;
|
||||
|
||||
/** @author Arjen Poutsma */
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* @author Arjen Poutsma
|
||||
*/
|
||||
public class AbstractJettyServerTestCase {
|
||||
|
||||
protected static String helloWorld = "H\u00e9llo W\u00f6rld";
|
||||
@@ -184,15 +190,8 @@ public class AbstractJettyServerTestCase {
|
||||
|
||||
private final String s;
|
||||
|
||||
|
||||
private final byte[] buf;
|
||||
|
||||
private final MediaType contentType;
|
||||
|
||||
private PutServlet(String s, byte[] buf, MediaType contentType) {
|
||||
this.s = s;
|
||||
this.buf = buf;
|
||||
this.contentType = contentType;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -226,24 +225,24 @@ public class AbstractJettyServerTestCase {
|
||||
FileItemFactory factory = new DiskFileItemFactory();
|
||||
ServletFileUpload upload = new ServletFileUpload(factory);
|
||||
try {
|
||||
List items = upload.parseRequest(req);
|
||||
List<FileItem> items = upload.parseRequest(req);
|
||||
assertEquals(4, items.size());
|
||||
FileItem item = (FileItem) items.get(0);
|
||||
FileItem item = items.get(0);
|
||||
assertTrue(item.isFormField());
|
||||
assertEquals("name 1", item.getFieldName());
|
||||
assertEquals("value 1", item.getString());
|
||||
|
||||
item = (FileItem) items.get(1);
|
||||
item = items.get(1);
|
||||
assertTrue(item.isFormField());
|
||||
assertEquals("name 2", item.getFieldName());
|
||||
assertEquals("value 2+1", item.getString());
|
||||
|
||||
item = (FileItem) items.get(2);
|
||||
item = items.get(2);
|
||||
assertTrue(item.isFormField());
|
||||
assertEquals("name 2", item.getFieldName());
|
||||
assertEquals("value 2+2", item.getString());
|
||||
|
||||
item = (FileItem) items.get(3);
|
||||
item = items.get(3);
|
||||
assertFalse(item.isFormField());
|
||||
assertEquals("logo", item.getFieldName());
|
||||
assertEquals("logo.jpg", item.getName());
|
||||
|
||||
@@ -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.
|
||||
@@ -43,7 +43,9 @@ import org.springframework.util.MultiValueMap;
|
||||
import org.springframework.util.concurrent.ListenableFuture;
|
||||
import org.springframework.util.concurrent.ListenableFutureCallback;
|
||||
|
||||
/** @author Arjen Poutsma */
|
||||
/**
|
||||
* @author Arjen Poutsma
|
||||
*/
|
||||
public class AsyncRestTemplateIntegrationTests extends AbstractJettyServerTestCase {
|
||||
|
||||
private AsyncRestTemplate template;
|
||||
@@ -398,7 +400,7 @@ public class AsyncRestTemplateIntegrationTests extends AbstractJettyServerTestCa
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void exchangeGet() throws Exception {
|
||||
HttpHeaders requestHeaders = new HttpHeaders();
|
||||
requestHeaders.set("MyHeader", "MyValue");
|
||||
@@ -411,7 +413,7 @@ public class AsyncRestTemplateIntegrationTests extends AbstractJettyServerTestCa
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void exchangeGetCallback() throws Exception {
|
||||
HttpHeaders requestHeaders = new HttpHeaders();
|
||||
requestHeaders.set("MyHeader", "MyValue");
|
||||
|
||||
@@ -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.
|
||||
@@ -41,7 +41,7 @@ import static org.mockito.BDDMockito.*;
|
||||
*/
|
||||
public class HttpMessageConverterExtractorTests {
|
||||
|
||||
private HttpMessageConverterExtractor extractor;
|
||||
private HttpMessageConverterExtractor<?> extractor;
|
||||
|
||||
private ClientHttpResponse response;
|
||||
|
||||
@@ -152,7 +152,8 @@ public class HttpMessageConverterExtractorTests {
|
||||
assertEquals(expected, result);
|
||||
}
|
||||
|
||||
private List<HttpMessageConverter<?>> createConverterList(HttpMessageConverter converter) {
|
||||
private List<HttpMessageConverter<?>> createConverterList(
|
||||
HttpMessageConverter<?> converter) {
|
||||
List<HttpMessageConverter<?>> converters = new ArrayList<HttpMessageConverter<?>>(1);
|
||||
converters.add(converter);
|
||||
return converters;
|
||||
|
||||
@@ -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.
|
||||
@@ -16,36 +16,16 @@
|
||||
|
||||
package org.springframework.web.client;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.servlet.GenericServlet;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.fileupload.FileItem;
|
||||
import org.apache.commons.fileupload.FileItemFactory;
|
||||
import org.apache.commons.fileupload.FileUploadException;
|
||||
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
|
||||
import org.apache.commons.fileupload.servlet.ServletFileUpload;
|
||||
import org.eclipse.jetty.server.Server;
|
||||
import org.eclipse.jetty.servlet.ServletContextHandler;
|
||||
import org.eclipse.jetty.servlet.ServletHolder;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.http.HttpEntity;
|
||||
@@ -55,14 +35,14 @@ import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
|
||||
import org.springframework.util.FileCopyUtils;
|
||||
import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
import org.springframework.util.SocketUtils;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/** @author Arjen Poutsma */
|
||||
/**
|
||||
* @author Arjen Poutsma
|
||||
*/
|
||||
public class RestTemplateIntegrationTests extends AbstractJettyServerTestCase {
|
||||
|
||||
private RestTemplate template;
|
||||
@@ -198,11 +178,10 @@ public class RestTemplateIntegrationTests extends AbstractJettyServerTestCase {
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void exchangeGet() throws Exception {
|
||||
HttpHeaders requestHeaders = new HttpHeaders();
|
||||
requestHeaders.set("MyHeader", "MyValue");
|
||||
HttpEntity<?> requestEntity = new HttpEntity(requestHeaders);
|
||||
HttpEntity<String> requestEntity = new HttpEntity<String>(requestHeaders);
|
||||
ResponseEntity<String> response =
|
||||
template.exchange(baseUrl + "/{method}", HttpMethod.GET, requestEntity, String.class, "get");
|
||||
assertEquals("Invalid content", helloWorld, response.getBody());
|
||||
|
||||
@@ -59,6 +59,7 @@ public class RestTemplateTests {
|
||||
|
||||
private ResponseErrorHandler errorHandler;
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
private HttpMessageConverter converter;
|
||||
|
||||
@Before
|
||||
@@ -640,6 +641,7 @@ public class RestTemplateTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("rawtypes")
|
||||
public void exchangeParameterizedType() throws Exception {
|
||||
GenericHttpMessageConverter converter = mock(GenericHttpMessageConverter.class);
|
||||
template.setMessageConverters(Collections.<HttpMessageConverter<?>>singletonList(converter));
|
||||
|
||||
Reference in New Issue
Block a user