Browse Source

Clean up warnings in spring-test

pull/1357/head
Sam Brannen 8 years ago
parent
commit
dda8beeb78
  1. 1
      spring-test/src/main/java/org/springframework/test/web/reactive/server/AbstractMockServerSpec.java
  2. 1
      spring-test/src/main/java/org/springframework/test/web/reactive/server/ApplicationContextSpec.java
  3. 1
      spring-test/src/main/java/org/springframework/test/web/reactive/server/DefaultControllerSpec.java
  4. 1
      spring-test/src/main/java/org/springframework/test/web/reactive/server/DefaultWebTestClientBuilder.java
  5. 4
      spring-test/src/main/java/org/springframework/test/web/reactive/server/EntityExchangeResult.java
  6. 1
      spring-test/src/main/java/org/springframework/test/web/reactive/server/ExchangeMutatorWebFilter.java
  7. 2
      spring-test/src/main/java/org/springframework/test/web/reactive/server/ExchangeResult.java
  8. 1
      spring-test/src/main/java/org/springframework/test/web/reactive/server/FluxExchangeResult.java
  9. 1
      spring-test/src/main/java/org/springframework/test/web/reactive/server/HeaderAssertions.java
  10. 1
      spring-test/src/main/java/org/springframework/test/web/reactive/server/HttpHandlerConnector.java
  11. 2
      spring-test/src/main/java/org/springframework/test/web/reactive/server/RouterFunctionSpec.java
  12. 2
      spring-test/src/main/java/org/springframework/test/web/reactive/server/StatusAssertions.java
  13. 1
      spring-test/src/main/java/org/springframework/test/web/reactive/server/WebTestClient.java
  14. 1
      spring-test/src/main/java/org/springframework/test/web/reactive/server/WiretapClientHttpRequest.java
  15. 3
      spring-test/src/main/java/org/springframework/test/web/reactive/server/WiretapClientHttpResponse.java
  16. 2
      spring-test/src/main/java/org/springframework/test/web/reactive/server/WiretapConnector.java
  17. 3
      spring-test/src/test/java/org/springframework/test/web/reactive/server/DefaultControllerSpecTests.java
  18. 5
      spring-test/src/test/java/org/springframework/test/web/reactive/server/HeaderAssertionsTests.java
  19. 3
      spring-test/src/test/java/org/springframework/test/web/reactive/server/HttpHandlerConnectorTests.java
  20. 7
      spring-test/src/test/java/org/springframework/test/web/reactive/server/StatusAssertionTests.java
  21. 2
      spring-test/src/test/java/org/springframework/test/web/reactive/server/WebTestClientConnectorTests.java
  22. 12
      spring-test/src/test/java/org/springframework/test/web/reactive/server/samples/ErrorTests.java
  23. 18
      spring-test/src/test/java/org/springframework/test/web/reactive/server/samples/HeaderTests.java
  24. 13
      spring-test/src/test/java/org/springframework/test/web/reactive/server/samples/ResponseEntityTests.java
  25. 3
      spring-test/src/test/java/org/springframework/test/web/reactive/server/samples/bind/ApplicationContextTests.java
  26. 16
      spring-test/src/test/java/org/springframework/test/web/reactive/server/samples/bind/ControllerTests.java
  27. 2
      spring-test/src/test/java/org/springframework/test/web/reactive/server/samples/bind/HttpServerTests.java
  28. 2
      spring-test/src/test/java/org/springframework/test/web/reactive/server/samples/bind/RouterFunctionTests.java

1
spring-test/src/main/java/org/springframework/test/web/reactive/server/AbstractMockServerSpec.java

@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.test.web.reactive.server;
import java.util.function.UnaryOperator;

1
spring-test/src/main/java/org/springframework/test/web/reactive/server/ApplicationContextSpec.java

@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.test.web.reactive.server;
import org.springframework.context.ApplicationContext;

1
spring-test/src/main/java/org/springframework/test/web/reactive/server/DefaultControllerSpec.java

@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.test.web.reactive.server;
import java.util.ArrayList;

1
spring-test/src/main/java/org/springframework/test/web/reactive/server/DefaultWebTestClientBuilder.java

@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.test.web.reactive.server;
import java.time.Duration;

4
spring-test/src/main/java/org/springframework/test/web/reactive/server/EntityExchangeResult.java

@ -13,16 +13,16 @@ @@ -13,16 +13,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.test.web.reactive.server;
/**
* {@code ExchangeResult} sub-class that exposes the response body fully
* extracted to a representation of type {@code <T>}.
*
* @param <T> the response body type
*
* @author Rossen Stoyanchev
* @since 5.0
* @param <T> the response body type
* @see FluxExchangeResult
*/
public class EntityExchangeResult<T> extends ExchangeResult {

1
spring-test/src/main/java/org/springframework/test/web/reactive/server/ExchangeMutatorWebFilter.java

@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.test.web.reactive.server;
import java.util.ArrayList;

2
spring-test/src/main/java/org/springframework/test/web/reactive/server/ExchangeResult.java

@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.test.web.reactive.server;
import java.net.URI;
@ -45,7 +46,6 @@ import org.springframework.util.MultiValueMap; @@ -45,7 +46,6 @@ import org.springframework.util.MultiValueMap;
*
* @author Rossen Stoyanchev
* @since 5.0
*
* @see EntityExchangeResult
* @see FluxExchangeResult
*/

1
spring-test/src/main/java/org/springframework/test/web/reactive/server/FluxExchangeResult.java

@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.test.web.reactive.server;
import java.time.Duration;

1
spring-test/src/main/java/org/springframework/test/web/reactive/server/HeaderAssertions.java

@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.test.web.reactive.server;
import java.util.Arrays;

1
spring-test/src/main/java/org/springframework/test/web/reactive/server/HttpHandlerConnector.java

@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.test.web.reactive.server;
import java.net.URI;

2
spring-test/src/main/java/org/springframework/test/web/reactive/server/RouterFunctionSpec.java

@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.test.web.reactive.server;
import org.springframework.context.ApplicationContext;
@ -48,7 +49,6 @@ public class RouterFunctionSpec extends AbstractMockServerSpec<RouterFunctionSpe @@ -48,7 +49,6 @@ public class RouterFunctionSpec extends AbstractMockServerSpec<RouterFunctionSpe
return WebHttpHandlerBuilder.applicationContext(initApplicationContext());
}
@SuppressWarnings("Convert2MethodRef")
private ApplicationContext initApplicationContext() {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
context.registerBean("webHandler", DispatcherHandler.class, () -> new DispatcherHandler());

2
spring-test/src/main/java/org/springframework/test/web/reactive/server/StatusAssertions.java

@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.test.web.reactive.server;
import org.springframework.http.HttpStatus;
@ -26,7 +27,6 @@ import static org.springframework.test.util.AssertionErrors.assertEquals; @@ -26,7 +27,6 @@ import static org.springframework.test.util.AssertionErrors.assertEquals;
* @since 5.0
* @see WebTestClient.ResponseSpec#expectStatus()
*/
@SuppressWarnings("unused")
public class StatusAssertions {
private final ExchangeResult exchangeResult;

1
spring-test/src/main/java/org/springframework/test/web/reactive/server/WebTestClient.java

@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.test.web.reactive.server;
import java.net.URI;

1
spring-test/src/main/java/org/springframework/test/web/reactive/server/WiretapClientHttpRequest.java

@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.test.web.reactive.server;
import org.reactivestreams.Publisher;

3
spring-test/src/main/java/org/springframework/test/web/reactive/server/WiretapClientHttpResponse.java

@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.test.web.reactive.server;
import reactor.core.publisher.Flux;
@ -25,7 +26,7 @@ import org.springframework.http.client.reactive.ClientHttpResponse; @@ -25,7 +26,7 @@ import org.springframework.http.client.reactive.ClientHttpResponse;
import org.springframework.http.client.reactive.ClientHttpResponseDecorator;
/**
* Client HTTP response decorator that interceptrs and saves the content read
* Client HTTP response decorator that intercepts and saves the content read
* from the server.
*
* @author Rossen Stoyanchev

2
spring-test/src/main/java/org/springframework/test/web/reactive/server/WiretapConnector.java

@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.test.web.reactive.server;
import java.net.URI;
@ -37,7 +38,6 @@ import org.springframework.util.Assert; @@ -37,7 +38,6 @@ import org.springframework.util.Assert;
*
* @author Rossen Stoyanchev
* @since 5.0
*
* @see HttpHandlerConnector
*/
class WiretapConnector implements ClientHttpConnector {

3
spring-test/src/test/java/org/springframework/test/web/reactive/server/DefaultControllerSpecTests.java

@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.test.web.reactive.server;
import org.junit.Test;
@ -25,7 +26,9 @@ import org.springframework.web.bind.annotation.RestController; @@ -25,7 +26,9 @@ import org.springframework.web.bind.annotation.RestController;
/**
* Unit tests for {@link DefaultControllerSpec}.
*
* @author Rossen Stoyanchev
* @since 5.0
*/
public class DefaultControllerSpecTests {

5
spring-test/src/test/java/org/springframework/test/web/reactive/server/HeaderAssertionsTests.java

@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.test.web.reactive.server;
import java.net.URI;
@ -27,17 +28,17 @@ import org.springframework.http.HttpStatus; @@ -27,17 +28,17 @@ import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.mock.http.client.reactive.MockClientHttpRequest;
import org.springframework.mock.http.client.reactive.MockClientHttpResponse;
import org.springframework.web.reactive.function.client.ClientResponse;
import static junit.framework.TestCase.assertNotNull;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
/**
* Unit tests for {@link HeaderAssertions}.
*
* @author Rossen Stoyanchev
* @since 5.0
*/
public class HeaderAssertionsTests {

3
spring-test/src/test/java/org/springframework/test/web/reactive/server/HttpHandlerConnectorTests.java

@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.test.web.reactive.server;
import java.net.URI;
@ -42,7 +43,9 @@ import static org.junit.Assert.assertEquals; @@ -42,7 +43,9 @@ import static org.junit.Assert.assertEquals;
/**
* Unit tests for {@link HttpHandlerConnector}.
*
* @author Rossen Stoyanchev
* @since 5.0
*/
public class HttpHandlerConnectorTests {

7
spring-test/src/test/java/org/springframework/test/web/reactive/server/StatusAssertionTests.java

@ -13,30 +13,29 @@ @@ -13,30 +13,29 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.test.web.reactive.server;
import java.net.URI;
import org.junit.Test;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.mock.http.client.reactive.MockClientHttpRequest;
import org.springframework.mock.http.client.reactive.MockClientHttpResponse;
import org.springframework.web.reactive.function.client.ClientResponse;
import static org.junit.Assert.fail;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
/**
* Unit tests for {@link StatusAssertions}.
*
* @author Rossen Stoyanchev
* @since 5.0
*/
public class StatusAssertionTests {
@Test
public void isEqualTo() throws Exception {

2
spring-test/src/test/java/org/springframework/test/web/reactive/server/WebTestClientConnectorTests.java

@ -39,10 +39,12 @@ import static org.junit.Assert.assertNotNull; @@ -39,10 +39,12 @@ import static org.junit.Assert.assertNotNull;
* Unit tests for {@link WiretapConnector}.
*
* @author Rossen Stoyanchev
* @since 5.0
*/
public class WebTestClientConnectorTests {
@Test
@SuppressWarnings("deprecation")
public void captureAndClaim() throws Exception {
ClientHttpRequest request = new MockClientHttpRequest(HttpMethod.GET, "/test");

12
spring-test/src/test/java/org/springframework/test/web/reactive/server/samples/ErrorTests.java

@ -13,9 +13,9 @@ @@ -13,9 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.test.web.reactive.server.samples;
import org.junit.Before;
import org.junit.Test;
import org.springframework.http.HttpStatus;
@ -27,17 +27,11 @@ import org.springframework.web.bind.annotation.RestController; @@ -27,17 +27,11 @@ import org.springframework.web.bind.annotation.RestController;
* Tests with error status codes or error conditions.
*
* @author Rossen Stoyanchev
* @since 5.0
*/
@SuppressWarnings("unused")
public class ErrorTests {
private WebTestClient client;
@Before
public void setUp() throws Exception {
this.client = WebTestClient.bindToController(new TestController()).build();
}
private final WebTestClient client = WebTestClient.bindToController(new TestController()).build();
@Test

18
spring-test/src/test/java/org/springframework/test/web/reactive/server/samples/HeaderTests.java

@ -13,9 +13,9 @@ @@ -13,9 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.test.web.reactive.server.samples;
import org.junit.Before;
import org.junit.Test;
import org.springframework.http.ResponseEntity;
@ -29,20 +29,14 @@ import org.springframework.web.bind.annotation.RestController; @@ -29,20 +29,14 @@ import org.springframework.web.bind.annotation.RestController;
* Tests with custom headers.
*
* @author Rossen Stoyanchev
* @since 5.0
*/
@SuppressWarnings("unused")
public class HeaderTests {
private WebTestClient client;
@Before
public void setUp() throws Exception {
this.client = WebTestClient
.bindToController(new TestController())
.configureClient().baseUrl("/header")
.build();
}
private final WebTestClient client = WebTestClient
.bindToController(new TestController())
.configureClient().baseUrl("/header")
.build();
@Test

13
spring-test/src/test/java/org/springframework/test/web/reactive/server/samples/ResponseEntityTests.java

@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.test.web.reactive.server.samples;
import java.net.URI;
@ -23,7 +24,6 @@ import java.util.Map; @@ -23,7 +24,6 @@ import java.util.Map;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.junit.Before;
import org.junit.Test;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
@ -48,17 +48,11 @@ import static org.springframework.http.MediaType.TEXT_EVENT_STREAM; @@ -48,17 +48,11 @@ import static org.springframework.http.MediaType.TEXT_EVENT_STREAM;
* Annotated controllers accepting and returning typed Objects.
*
* @author Rossen Stoyanchev
* @since 5.0
*/
@SuppressWarnings("unused")
public class ResponseEntityTests {
private WebTestClient client;
@Before
public void setUp() throws Exception {
this.client = WebTestClient.bindToController(new PersonController()).build();
}
private final WebTestClient client = WebTestClient.bindToController(new PersonController()).build();
@Test
@ -152,6 +146,7 @@ public class ResponseEntityTests { @@ -152,6 +146,7 @@ public class ResponseEntityTests {
}
@GetMapping(produces = "text/event-stream")
@SuppressWarnings("deprecation")
Flux<Person> getPersonStream() {
return Flux.intervalMillis(100).onBackpressureBuffer(10).map(index -> new Person("N" + index));
}

3
spring-test/src/test/java/org/springframework/test/web/reactive/server/samples/bind/ApplicationContextTests.java

@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.test.web.reactive.server.samples.bind;
import java.security.Principal;
@ -38,8 +39,8 @@ import static org.mockito.Mockito.when; @@ -38,8 +39,8 @@ import static org.mockito.Mockito.when;
* Binding to server infrastructure declared in a Spring ApplicationContext.
*
* @author Rossen Stoyanchev
* @since 5.0
*/
@SuppressWarnings("unused")
public class ApplicationContextTests {
private WebTestClient client;

16
spring-test/src/test/java/org/springframework/test/web/reactive/server/samples/bind/ControllerTests.java

@ -13,12 +13,12 @@ @@ -13,12 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.test.web.reactive.server.samples.bind;
import java.security.Principal;
import java.util.function.UnaryOperator;
import org.junit.Before;
import org.junit.Test;
import reactor.core.publisher.Mono;
@ -34,19 +34,15 @@ import static org.mockito.Mockito.when; @@ -34,19 +34,15 @@ import static org.mockito.Mockito.when;
* Bind to annotated controllers.
*
* @author Rossen Stoyanchev
* @since 5.0
*/
@SuppressWarnings("unused")
public class ControllerTests {
private WebTestClient client;
private final WebTestClient client = WebTestClient
.bindToController(new TestController())
.exchangeMutator(identitySetup("Pablo"))
.build();
@Before
public void setUp() throws Exception {
this.client = WebTestClient.bindToController(new TestController())
.exchangeMutator(identitySetup("Pablo"))
.build();
}
private UnaryOperator<ServerWebExchange> identitySetup(String userName) {
return exchange -> {

2
spring-test/src/test/java/org/springframework/test/web/reactive/server/samples/bind/HttpServerTests.java

@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.test.web.reactive.server.samples.bind;
import org.junit.After;
@ -33,6 +34,7 @@ import static org.springframework.web.reactive.function.server.RouterFunctions.r @@ -33,6 +34,7 @@ import static org.springframework.web.reactive.function.server.RouterFunctions.r
* Bind to a running server, making actual requests over a socket.
*
* @author Rossen Stoyanchev
* @since 5.0
*/
public class HttpServerTests {

2
spring-test/src/test/java/org/springframework/test/web/reactive/server/samples/bind/RouterFunctionTests.java

@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.test.web.reactive.server.samples.bind;
import org.junit.Before;
@ -30,6 +31,7 @@ import static org.springframework.web.reactive.function.server.RouterFunctions.r @@ -30,6 +31,7 @@ import static org.springframework.web.reactive.function.server.RouterFunctions.r
* Bind to a {@link RouterFunction} and functional endpoints.
*
* @author Rossen Stoyanchev
* @since 5.0
*/
public class RouterFunctionTests {

Loading…
Cancel
Save