Use encode with an Object value where feasible

Closes gh-22782
This commit is contained in:
Rossen Stoyanchev
2019-04-11 18:56:54 -04:00
parent 181482fa15
commit 5fc18064f2
7 changed files with 69 additions and 106 deletions

View File

@@ -81,7 +81,7 @@ public class MessageMappingMessageHandlerTests {
@Test
public void handleFluxString() {
MessageMappingMessageHandler messsageHandler = initMesssageHandler();
messsageHandler.handleMessage(message("fluxString", "abc\ndef\nghi")).block(Duration.ofSeconds(5));
messsageHandler.handleMessage(message("fluxString", "abc", "def", "ghi")).block(Duration.ofSeconds(5));
verifyOutputContent(Arrays.asList("abc::response", "def::response", "ghi::response"));
}

View File

@@ -129,9 +129,10 @@ public class PayloadMethodArgumentResolverTests {
@Test
public void validateStringMono() {
TestValidator validator = new TestValidator();
ResolvableType type = ResolvableType.forClassWithGenerics(Mono.class, String.class);
MethodParameter param = this.testMethod.arg(type);
Mono<Object> mono = resolveValue(param, Mono.just(toDataBuffer("12345")), new TestValidator());
Mono<Object> mono = resolveValue(param, Mono.just(toDataBuffer("12345")), validator);
StepVerifier.create(mono).expectNextCount(0)
.expectError(MethodArgumentNotValidException.class).verify();
@@ -139,9 +140,11 @@ public class PayloadMethodArgumentResolverTests {
@Test
public void validateStringFlux() {
TestValidator validator = new TestValidator();
ResolvableType type = ResolvableType.forClassWithGenerics(Flux.class, String.class);
MethodParameter param = this.testMethod.arg(type);
Flux<Object> flux = resolveValue(param, Mono.just(toDataBuffer("12345678\n12345")), new TestValidator());
Flux<DataBuffer> content = Flux.just(toDataBuffer("12345678"), toDataBuffer("12345"));
Flux<Object> flux = resolveValue(param, content, validator);
StepVerifier.create(flux)
.expectNext("12345678")