Avoid ConstantConditions warnings suppression (plus related polishing)

Issue: SPR-15756
This commit is contained in:
Juergen Hoeller
2018-05-29 21:47:10 +02:00
parent 8c30b8e628
commit 8593fec22c
12 changed files with 78 additions and 92 deletions

View File

@@ -249,9 +249,7 @@ public class RequestPartMethodArgumentResolverTests {
return (T) value;
}
@SuppressWarnings("ConstantConditions")
private ServerWebExchange createExchange(MultipartBodyBuilder builder) {
MockClientHttpRequest clientRequest = new MockClientHttpRequest(HttpMethod.POST, "/");
this.writer.write(Mono.just(builder.build()), forClass(MultiValueMap.class),
MediaType.MULTIPART_FORM_DATA, clientRequest, Collections.emptyMap()).block();

View File

@@ -56,16 +56,13 @@ import org.springframework.web.reactive.HandlerResult;
import org.springframework.web.reactive.accept.RequestedContentTypeResolver;
import org.springframework.web.reactive.accept.RequestedContentTypeResolverBuilder;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.springframework.core.ResolvableType.forClassWithGenerics;
import static org.springframework.http.MediaType.APPLICATION_JSON;
import static org.springframework.http.ResponseEntity.notFound;
import static org.springframework.http.ResponseEntity.ok;
import static org.springframework.mock.http.server.reactive.test.MockServerHttpRequest.get;
import static org.springframework.web.method.ResolvableMethod.on;
import static org.springframework.web.reactive.HandlerMapping.PRODUCIBLE_MEDIA_TYPES_ATTRIBUTE;
import static org.junit.Assert.*;
import static org.springframework.core.ResolvableType.*;
import static org.springframework.http.MediaType.*;
import static org.springframework.http.ResponseEntity.*;
import static org.springframework.mock.http.server.reactive.test.MockServerHttpRequest.*;
import static org.springframework.web.method.ResolvableMethod.*;
import static org.springframework.web.reactive.HandlerMapping.*;
/**
* Unit tests for {@link ResponseEntityResultHandler}. When adding a test also
@@ -106,9 +103,7 @@ public class ResponseEntityResultHandlerTests {
@Test
@SuppressWarnings("ConstantConditions")
public void supports() throws NoSuchMethodException {
public void supports() throws Exception {
Object value = null;
MethodParameter returnType = on(TestController.class).resolveReturnType(entity(String.class));
@@ -133,9 +128,7 @@ public class ResponseEntityResultHandlerTests {
}
@Test
@SuppressWarnings("ConstantConditions")
public void doesNotSupport() throws NoSuchMethodException {
public void doesNotSupport() throws Exception {
Object value = null;
MethodParameter returnType = on(TestController.class).resolveReturnType(String.class);
@@ -417,7 +410,6 @@ public class ResponseEntityResultHandlerTests {
Flux<?> fluxWildcard() { return null; }
Object object() { return null; }
}
}