diff --git a/spring-messaging/src/main/java/org/springframework/messaging/handler/annotation/support/MessageMethodArgumentResolver.java b/spring-messaging/src/main/java/org/springframework/messaging/handler/annotation/support/MessageMethodArgumentResolver.java
index 2d695d8adf..8a337715a5 100644
--- a/spring-messaging/src/main/java/org/springframework/messaging/handler/annotation/support/MessageMethodArgumentResolver.java
+++ b/spring-messaging/src/main/java/org/springframework/messaging/handler/annotation/support/MessageMethodArgumentResolver.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2016 the original author or authors.
+ * Copyright 2002-2018 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.
@@ -97,7 +97,7 @@ public class MessageMethodArgumentResolver implements HandlerMethodArgumentResol
private Class> getPayloadType(MethodParameter parameter) {
Type genericParamType = parameter.getGenericParameterType();
ResolvableType resolvableType = ResolvableType.forType(genericParamType).as(Message.class);
- return resolvableType.getGeneric(0).resolve(Object.class);
+ return resolvableType.getGeneric().resolve(Object.class);
}
/**
diff --git a/spring-test/src/main/java/org/springframework/mock/http/client/reactive/MockClientHttpRequest.java b/spring-test/src/main/java/org/springframework/mock/http/client/reactive/MockClientHttpRequest.java
index d6fc9ebd00..0ebf84dc1d 100644
--- a/spring-test/src/main/java/org/springframework/mock/http/client/reactive/MockClientHttpRequest.java
+++ b/spring-test/src/main/java/org/springframework/mock/http/client/reactive/MockClientHttpRequest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2016 the original author or authors.
+ * Copyright 2002-2018 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,6 +36,7 @@ import org.springframework.web.util.UriComponentsBuilder;
/**
* Mock implementation of {@link ClientHttpRequest}.
+ *
* @author Brian Clozel
* @author Rossen Stoyanchev
* @since 5.0
@@ -97,11 +98,9 @@ public class MockClientHttpRequest extends AbstractClientHttpRequest {
/**
* Configure a custom handler for writing the request body.
- *
*
The default write handler consumes and caches the request body so it
* may be accessed subsequently, e.g. in test assertions. Use this property
* when the request body is an infinite stream.
- *
* @param writeHandler the write handler to use returning {@code Mono}
* when the body has been "written" (i.e. consumed).
*/
diff --git a/spring-test/src/main/java/org/springframework/mock/http/server/reactive/MockServerHttpResponse.java b/spring-test/src/main/java/org/springframework/mock/http/server/reactive/MockServerHttpResponse.java
index 14665c9c93..325fb3d461 100644
--- a/spring-test/src/main/java/org/springframework/mock/http/server/reactive/MockServerHttpResponse.java
+++ b/spring-test/src/main/java/org/springframework/mock/http/server/reactive/MockServerHttpResponse.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2017 the original author or authors.
+ * Copyright 2002-2018 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.
@@ -125,10 +125,8 @@ public class MockServerHttpResponse extends AbstractServerHttpResponse {
* charset or "UTF-8" by default.
*/
public Mono getBodyAsString() {
-
Charset charset = Optional.ofNullable(getHeaders().getContentType()).map(MimeType::getCharset)
.orElse(StandardCharsets.UTF_8);
-
return getBody()
.reduce(bufferFactory().allocateBuffer(), (previous, current) -> {
previous.write(current);
@@ -139,7 +137,6 @@ public class MockServerHttpResponse extends AbstractServerHttpResponse {
}
private static String bufferToString(DataBuffer buffer, Charset charset) {
- Assert.notNull(charset, "'charset' must not be null");
byte[] bytes = new byte[buffer.readableByteCount()];
buffer.read(bytes);
return new String(bytes, charset);
diff --git a/spring-test/src/main/java/org/springframework/test/web/client/AbstractRequestExpectationManager.java b/spring-test/src/main/java/org/springframework/test/web/client/AbstractRequestExpectationManager.java
index c62200b3e7..460d7b4f3e 100644
--- a/spring-test/src/main/java/org/springframework/test/web/client/AbstractRequestExpectationManager.java
+++ b/spring-test/src/main/java/org/springframework/test/web/client/AbstractRequestExpectationManager.java
@@ -239,13 +239,16 @@ public abstract class AbstractRequestExpectationManager implements RequestExpect
/**
* Add expectations to this group.
- * @deprecated as of 5.0.3 please use {@link #addAllExpectations(Collection)} instead.
+ * @deprecated as of 5.0.3, if favor of {@link #addAllExpectations}
*/
@Deprecated
public void updateAll(Collection expectations) {
expectations.forEach(this::updateInternal);
}
+ /**
+ * Reset all expectations for this group.
+ */
public void reset() {
this.expectations.clear();
}
diff --git a/spring-web/src/main/java/org/springframework/http/codec/ServerSentEventHttpMessageReader.java b/spring-web/src/main/java/org/springframework/http/codec/ServerSentEventHttpMessageReader.java
index 930edf1371..00da032fe1 100644
--- a/spring-web/src/main/java/org/springframework/http/codec/ServerSentEventHttpMessageReader.java
+++ b/spring-web/src/main/java/org/springframework/http/codec/ServerSentEventHttpMessageReader.java
@@ -103,7 +103,7 @@ public class ServerSentEventHttpMessageReader implements HttpMessageReader hints) {
boolean shouldWrap = isServerSentEvent(elementType);
- ResolvableType valueType = (shouldWrap ? elementType.getGeneric(0) : elementType);
+ ResolvableType valueType = (shouldWrap ? elementType.getGeneric() : elementType);
return stringDecoder.decode(message.getBody(), STRING_TYPE, null, Collections.emptyMap())
.bufferUntil(line -> line.equals(""))
diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/result/method/annotation/AbstractMessageWriterResultHandler.java b/spring-webflux/src/main/java/org/springframework/web/reactive/result/method/annotation/AbstractMessageWriterResultHandler.java
index 788c6a8c31..32ad6b08bf 100644
--- a/spring-webflux/src/main/java/org/springframework/web/reactive/result/method/annotation/AbstractMessageWriterResultHandler.java
+++ b/spring-webflux/src/main/java/org/springframework/web/reactive/result/method/annotation/AbstractMessageWriterResultHandler.java
@@ -123,7 +123,7 @@ public abstract class AbstractMessageWriterResultHandler extends HandlerResultHa
ResolvableType elementType;
if (adapter != null) {
publisher = adapter.toPublisher(body);
- ResolvableType genericType = bodyType.getGeneric(0);
+ ResolvableType genericType = bodyType.getGeneric();
elementType = getElementType(adapter, genericType);
}
else {
diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/result/view/AbstractView.java b/spring-webflux/src/main/java/org/springframework/web/reactive/result/view/AbstractView.java
index e66a610284..3b3efd5e4c 100644
--- a/spring-webflux/src/main/java/org/springframework/web/reactive/result/view/AbstractView.java
+++ b/spring-webflux/src/main/java/org/springframework/web/reactive/result/view/AbstractView.java
@@ -57,9 +57,9 @@ public abstract class AbstractView implements View, BeanNameAware, ApplicationCo
private static final Object NO_VALUE = new Object();
- private final List mediaTypes = new ArrayList<>(4);
+ private final ReactiveAdapterRegistry reactiveAdapterRegistry;
- private final ReactiveAdapterRegistry adapterRegistry;
+ private final List mediaTypes = new ArrayList<>(4);
private Charset defaultCharset = StandardCharsets.UTF_8;
@@ -77,9 +77,9 @@ public abstract class AbstractView implements View, BeanNameAware, ApplicationCo
this(ReactiveAdapterRegistry.getSharedInstance());
}
- public AbstractView(ReactiveAdapterRegistry registry) {
+ public AbstractView(ReactiveAdapterRegistry reactiveAdapterRegistry) {
+ this.reactiveAdapterRegistry = reactiveAdapterRegistry;
this.mediaTypes.add(ViewResolverSupport.DEFAULT_CONTENT_TYPE);
- this.adapterRegistry = registry;
}
@@ -232,7 +232,6 @@ public abstract class AbstractView implements View, BeanNameAware, ApplicationCo
* @return {@code Mono} for the completion of async attributes resolution
*/
protected Mono resolveAsyncAttributes(Map model) {
-
List names = new ArrayList<>();
List> valueMonos = new ArrayList<>();
@@ -241,7 +240,7 @@ public abstract class AbstractView implements View, BeanNameAware, ApplicationCo
if (value == null) {
continue;
}
- ReactiveAdapter adapter = this.adapterRegistry.getAdapter(null, value);
+ ReactiveAdapter adapter = this.reactiveAdapterRegistry.getAdapter(null, value);
if (adapter != null) {
names.add(entry.getKey());
if (adapter.isMultiValue()) {
diff --git a/spring-webflux/src/test/java/org/springframework/web/reactive/FlushingIntegrationTests.java b/spring-webflux/src/test/java/org/springframework/web/reactive/FlushingIntegrationTests.java
index 9f73c560fd..83a5e73547 100644
--- a/spring-webflux/src/test/java/org/springframework/web/reactive/FlushingIntegrationTests.java
+++ b/spring-webflux/src/test/java/org/springframework/web/reactive/FlushingIntegrationTests.java
@@ -77,13 +77,14 @@ public class FlushingIntegrationTests extends AbstractHttpHandlerIntegrationTest
try {
StepVerifier.create(result)
- .consumeNextWith(value -> assertTrue(value.length() == 20000 * "0123456789".length()))
+ .consumeNextWith(value -> assertTrue(value.length() >= 20000 * "0123456789".length()))
.expectComplete()
.verify(Duration.ofSeconds(10L));
}
catch (AssertionError err) {
String os = System.getProperty("os.name").toLowerCase();
- if (os.contains("windows") && err.getMessage().startsWith("VerifySubscriber timed out")) {
+ if (os.contains("windows") && err.getMessage() != null &&
+ err.getMessage().startsWith("VerifySubscriber timed out")) {
// TODO: Reactor usually times out on Windows ...
err.printStackTrace();
return;
diff --git a/spring-webflux/src/test/java/org/springframework/web/reactive/function/BodyExtractorsTests.java b/spring-webflux/src/test/java/org/springframework/web/reactive/function/BodyExtractorsTests.java
index fd7d005581..17bf294cc1 100644
--- a/spring-webflux/src/test/java/org/springframework/web/reactive/function/BodyExtractorsTests.java
+++ b/spring-webflux/src/test/java/org/springframework/web/reactive/function/BodyExtractorsTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2017 the original author or authors.
+ * Copyright 2002-2018 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.
@@ -56,10 +56,8 @@ import org.springframework.http.server.reactive.ServerHttpResponse;
import org.springframework.mock.http.server.reactive.test.MockServerHttpRequest;
import org.springframework.util.MultiValueMap;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.springframework.http.codec.json.Jackson2CodecSupport.JSON_VIEW_HINT;
+import static org.junit.Assert.*;
+import static org.springframework.http.codec.json.Jackson2CodecSupport.*;
/**
* @author Arjen Poutsma
@@ -171,7 +169,7 @@ public class BodyExtractorsTests {
.verify();
}
- @Test // SPR-15758
+ @Test // SPR-15758
public void toMonoWithEmptyBodyAndNoContentType() {
BodyExtractor>, ReactiveHttpInputMessage> extractor =
BodyExtractors.toMono(new ParameterizedTypeReference