Browse Source

Clean up imports and warnings

pull/488/head
Sam Brannen 12 years ago
parent
commit
9dcd03d862
  1. 4
      spring-oxm/src/main/java/org/springframework/oxm/xstream/XStreamMarshaller.java
  2. 17
      spring-oxm/src/test/java/org/springframework/oxm/jibx/JibxMarshallerTests.java
  3. 1
      spring-web/src/main/java/org/springframework/web/context/request/ServletWebRequest.java
  4. 16
      spring-web/src/test/java/org/springframework/http/converter/json/Jackson2ObjectMapperFactoryBeanTests.java
  5. 3
      spring-web/src/test/java/org/springframework/http/converter/xml/Jaxb2CollectionHttpMessageConverterTests.java
  6. 8
      spring-web/src/test/java/org/springframework/http/converter/xml/SourceHttpMessageConverterTests.java
  7. 29
      spring-web/src/test/java/org/springframework/web/client/AbstractJettyServerTestCase.java
  8. 10
      spring-web/src/test/java/org/springframework/web/client/AsyncRestTemplateIntegrationTests.java
  9. 7
      spring-web/src/test/java/org/springframework/web/client/HttpMessageConverterExtractorTests.java
  10. 33
      spring-web/src/test/java/org/springframework/web/client/RestTemplateIntegrationTests.java
  11. 2
      spring-web/src/test/java/org/springframework/web/client/RestTemplateTests.java

4
spring-oxm/src/main/java/org/springframework/oxm/xstream/XStreamMarshaller.java

@ -27,8 +27,8 @@ import java.lang.reflect.Constructor; @@ -27,8 +27,8 @@ import java.lang.reflect.Constructor;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import javax.xml.stream.*;
import javax.xml.transform.stax.StAXSource;
import javax.xml.transform.stream.StreamSource;
import com.thoughtworks.xstream.MarshallingStrategy;
@ -59,9 +59,11 @@ import com.thoughtworks.xstream.io.xml.XppDriver; @@ -59,9 +59,11 @@ import com.thoughtworks.xstream.io.xml.XppDriver;
import com.thoughtworks.xstream.mapper.CannotResolveClassException;
import com.thoughtworks.xstream.mapper.Mapper;
import com.thoughtworks.xstream.mapper.MapperWrapper;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.xml.sax.ContentHandler;
import org.xml.sax.InputSource;
import org.xml.sax.XMLReader;

17
spring-oxm/src/test/java/org/springframework/oxm/jibx/JibxMarshallerTests.java

@ -1,5 +1,5 @@ @@ -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,34 +16,21 @@ @@ -16,34 +16,21 @@
package org.springframework.oxm.jibx;
import java.io.IOException;
import java.io.StringWriter;
import java.util.concurrent.atomic.AtomicReference;
import javax.xml.transform.sax.SAXSource;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import org.custommonkey.xmlunit.XMLUnit;
import org.junit.BeforeClass;
import org.junit.Test;
import org.mockito.ArgumentCaptor;
import org.springframework.oxm.AbstractMarshallerTests;
import org.springframework.oxm.Marshaller;
import org.springframework.oxm.XmlMappingException;
import org.springframework.oxm.jaxb.Jaxb2Marshaller;
import org.springframework.tests.Assume;
import org.springframework.tests.TestGroup;
import org.xml.sax.InputSource;
import org.xml.sax.XMLReader;
import static org.custommonkey.xmlunit.XMLAssert.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.reset;
import static org.mockito.Mockito.verify;
/**
* @author Arjen Poutsma
@ -114,7 +101,7 @@ public class JibxMarshallerTests extends AbstractMarshallerTests { @@ -114,7 +101,7 @@ public class JibxMarshallerTests extends AbstractMarshallerTests {
}
@Test
public void testSupports() throws Exception {
public void supports() throws Exception {
assertTrue("JibxMarshaller does not support Flights", marshaller.supports(Flights.class));
assertTrue("JibxMarshaller does not support FlightType", marshaller.supports(FlightType.class));
assertFalse("JibxMarshaller supports illegal type", marshaller.supports(getClass()));

1
spring-web/src/main/java/org/springframework/web/context/request/ServletWebRequest.java

@ -25,7 +25,6 @@ import javax.servlet.http.HttpServletResponse; @@ -25,7 +25,6 @@ import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;

16
spring-web/src/test/java/org/springframework/http/converter/json/Jackson2ObjectMapperFactoryBeanTests.java

@ -23,6 +23,11 @@ import java.util.Date; @@ -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; @@ -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.

3
spring-web/src/test/java/org/springframework/http/converter/xml/Jaxb2CollectionHttpMessageConverterTests.java

@ -1,5 +1,5 @@ @@ -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; @@ -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}.

8
spring-web/src/test/java/org/springframework/http/converter/xml/SourceHttpMessageConverterTests.java

@ -1,5 +1,5 @@ @@ -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; @@ -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; @@ -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 { @@ -162,7 +161,6 @@ public class SourceHttpMessageConverterTests {
streamReader.close();
}
@Test
public void readStreamSource() throws Exception {
MockHttpInputMessage inputMessage = new MockHttpInputMessage(BODY.getBytes("UTF-8"));

29
spring-web/src/test/java/org/springframework/web/client/AbstractJettyServerTestCase.java

@ -1,5 +1,5 @@ @@ -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; @@ -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; @@ -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 { @@ -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 { @@ -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());

10
spring-web/src/test/java/org/springframework/web/client/AsyncRestTemplateIntegrationTests.java

@ -1,5 +1,5 @@ @@ -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; @@ -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 @@ -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 @@ -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");

7
spring-web/src/test/java/org/springframework/web/client/HttpMessageConverterExtractorTests.java

@ -1,5 +1,5 @@ @@ -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.*; @@ -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 { @@ -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;

33
spring-web/src/test/java/org/springframework/web/client/RestTemplateIntegrationTests.java

@ -1,5 +1,5 @@ @@ -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 @@ @@ -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; @@ -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 { @@ -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());

2
spring-web/src/test/java/org/springframework/web/client/RestTemplateTests.java

@ -59,6 +59,7 @@ public class RestTemplateTests { @@ -59,6 +59,7 @@ public class RestTemplateTests {
private ResponseErrorHandler errorHandler;
@SuppressWarnings("rawtypes")
private HttpMessageConverter converter;
@Before
@ -640,6 +641,7 @@ public class RestTemplateTests { @@ -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));

Loading…
Cancel
Save