Clean up warnings in spring-web

This commit is contained in:
Sam Brannen
2016-07-15 18:38:27 +02:00
parent 58804da369
commit 3f317b7d3f
27 changed files with 31 additions and 64 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 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.
@@ -25,7 +25,8 @@ import org.springframework.http.HttpMethod;
*/
public class OkHttpAsyncClientHttpRequestFactoryTests extends AbstractAsyncHttpRequestFactoryTestCase {
@Override
@Override
@SuppressWarnings("deprecation")
protected AsyncClientHttpRequestFactory createRequestFactory() {
return new OkHttpClientHttpRequestFactory();
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 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.
@@ -26,6 +26,7 @@ import org.springframework.http.HttpMethod;
public class OkHttpClientHttpRequestFactoryTests extends AbstractHttpRequestFactoryTestCase {
@Override
@SuppressWarnings("deprecation")
protected ClientHttpRequestFactory createRequestFactory() {
return new OkHttpClientHttpRequestFactory();
}

View File

@@ -84,9 +84,7 @@ public class JacksonJsonDecoderTests extends AbstractDataBufferAllocatingTestCas
assertValues(new Pojo("f1", "b1"), new Pojo("f2", "b2"));
}
@SuppressWarnings("unused")
void handle(List<Pojo> list) {
}
}

View File

@@ -34,9 +34,9 @@ import org.springframework.http.MediaType;
import org.springframework.http.codec.Pojo;
import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual;
import static org.custommonkey.xmlunit.XMLAssert.fail;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
/**
* @author Sebastien Deleuze

View File

@@ -197,7 +197,6 @@ public class SpringHandlerInstantiatorTests {
}
// Only needed when compiling against Jackson 2.7; gone in 2.8
@SuppressWarnings("deprecation")
public JavaType typeFromId(String s) {
return TypeFactory.defaultInstance().constructFromCanonical(s);
}

View File

@@ -35,9 +35,8 @@ import org.springframework.web.client.RestTemplate;
import static org.junit.Assert.assertThat;
/**
* Temporarily does not extend AbstractHttpHandlerIntegrationTests.
*
* @author Stephane Maldini
* @since 5.0
*/
public class AsyncIntegrationTests extends AbstractHttpHandlerIntegrationTests {
@@ -50,12 +49,11 @@ public class AsyncIntegrationTests extends AbstractHttpHandlerIntegrationTests {
return new AsyncHandler();
}
@SuppressWarnings("unchecked")
@Test
public void basicTest() throws Exception {
URI url = new URI("http://localhost:" + port);
ResponseEntity<String> response = new RestTemplate().exchange(RequestEntity.get(url)
.build(), String.class);
ResponseEntity<String> response = new RestTemplate().exchange(
RequestEntity.get(url).build(), String.class);
assertThat(response.getBody(), Matchers.equalTo("hello"));
}
@@ -65,8 +63,8 @@ public class AsyncIntegrationTests extends AbstractHttpHandlerIntegrationTests {
@Override
public Mono<Void> handle(ServerHttpRequest request, ServerHttpResponse response) {
return response.writeWith(Flux.just("h", "e", "l", "l", "o")
.delay(Duration.ofMillis(100))
.publishOn(asyncGroup)
.delay(Duration.ofMillis(100))
.publishOn(asyncGroup)
.collect(dataBufferFactory::allocateBuffer, (buffer, str) -> buffer.write(str.getBytes())));
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 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.
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.http.server.reactive;
import java.util.ArrayList;
@@ -37,7 +38,6 @@ import static org.junit.Assert.*;
* @author Rossen Stoyanchev
* @author Stephane Maldini
*/
@SuppressWarnings("ThrowableResultOfMethodCallIgnored")
public class ChannelSendOperatorTests {
private OneByOneAsyncWriter writer;
@@ -176,15 +176,4 @@ public class ChannelSendOperatorTests {
}
}
private final static Subscription NO_OP_SUBSCRIPTION = new Subscription() {
@Override
public void request(long n) {
}
@Override
public void cancel() {
}
};
}

View File

@@ -19,8 +19,6 @@ package org.springframework.http.server.reactive;
import org.junit.Before;
import org.junit.Test;
import static org.springframework.web.client.reactive.ClientWebRequestBuilders.get;
import static org.springframework.web.client.reactive.ResponseExtractors.bodyStream;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import reactor.core.test.TestSubscriber;
@@ -87,4 +85,5 @@ public class FlushingIntegrationTests extends AbstractHttpHandlerIntegrationTest
return response.writeWith(responseBody);
}
}
}

View File

@@ -89,17 +89,11 @@ public class RandomHandlerIntegrationTests extends AbstractHttpHandlerIntegratio
assertEquals(REQUEST_SIZE, (long) size);
});
response.getHeaders().setContentLength(RESPONSE_SIZE);
return requestSizeMono.then(response.writeWith(multipleChunks()));
}
private Publisher<DataBuffer> singleChunk() {
return Mono.just(randomBuffer(RESPONSE_SIZE));
}
private Publisher<DataBuffer> multipleChunks() {
int chunkSize = RESPONSE_SIZE / CHUNKS;
return Flux.range(1, CHUNKS).map(integer -> randomBuffer(chunkSize));

View File

@@ -56,7 +56,7 @@ public class ZeroCopyIntegrationTests extends AbstractHttpHandlerIntegrationTest
RestTemplate restTemplate = new RestTemplate();
RequestEntity request =
RequestEntity<?> request =
RequestEntity.get(new URI("http://localhost:" + port)).build();
ResponseEntity<byte[]> response = restTemplate.exchange(request, byte[].class);

View File

@@ -38,7 +38,6 @@ import static org.junit.Assert.*;
* @author Sam Brannen
* @since 16.05.2003
*/
@SuppressWarnings("deprecation")
public class CauchoRemotingTests {
@Rule

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 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.
@@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.web.server.handler;
package org.springframework.web.server.handler;
import java.net.URI;
@@ -37,8 +37,8 @@ import static org.junit.Assert.assertEquals;
/**
* @author Rossen Stoyanchev
* @since 5.0
*/
@SuppressWarnings("ThrowableResultOfMethodCallIgnored")
public class ExceptionHandlingHttpHandlerTests {
private MockServerHttpResponse response;

View File

@@ -13,13 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.web.server.session;
import java.net.URI;
import java.net.URISyntaxException;
import java.time.Clock;
import java.time.Duration;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
@@ -133,7 +133,6 @@ public class WebSessionIntegrationTests extends AbstractHttpHandlerIntegrationTe
assertNotNull(headerValues);
assertEquals(1, headerValues.size());
List<String> data = new ArrayList<>();
for (String s : headerValues.get(0).split(";")){
if (s.startsWith("SESSION=")) {
return s.substring("SESSION=".length());