diff --git a/spring-web-reactive/src/test/java/org/springframework/web/reactive/method/annotation/RequestMappingIntegrationTests.java b/spring-web-reactive/src/test/java/org/springframework/web/reactive/method/annotation/RequestMappingIntegrationTests.java index 7c84c6e6eb..07547e21a2 100644 --- a/spring-web-reactive/src/test/java/org/springframework/web/reactive/method/annotation/RequestMappingIntegrationTests.java +++ b/spring-web-reactive/src/test/java/org/springframework/web/reactive/method/annotation/RequestMappingIntegrationTests.java @@ -546,74 +546,50 @@ public class RequestMappingIntegrationTests extends AbstractHttpHandlerIntegrati @RequestMapping("/publisher-capitalize") public Publisher publisherCapitalize(@RequestBody Publisher persons) { - return Stream.from(persons).map(person -> { - person.setName(person.getName().toUpperCase()); - return person; - }); + return Stream + .from(persons) + .map(person -> new Person(person.getName().toUpperCase())); } @RequestMapping("/flux-capitalize") public Flux fluxCapitalize(@RequestBody Flux persons) { - return persons.map(person -> { - person.setName(person.getName().toUpperCase()); - return person; - }); + return persons.map(person -> new Person(person.getName().toUpperCase())); } @RequestMapping("/observable-capitalize") public Observable observableCapitalize(@RequestBody Observable persons) { - return persons.map(person -> { - person.setName(person.getName().toUpperCase()); - return person; - }); + return persons.map(person -> new Person(person.getName().toUpperCase())); } @RequestMapping("/stream-capitalize") public Stream streamCapitalize(@RequestBody Stream persons) { - return persons.map(person -> { - person.setName(person.getName().toUpperCase()); - return person; - }); + return persons.map(person -> new Person(person.getName().toUpperCase())); } @RequestMapping("/person-capitalize") public Person personCapitalize(@RequestBody Person person) { - person.setName(person.getName().toUpperCase()); - return person; + return new Person(person.getName().toUpperCase()); } @RequestMapping("/completable-future-capitalize") public CompletableFuture completableFutureCapitalize( @RequestBody CompletableFuture personFuture) { - - return personFuture.thenApply(person -> { - person.setName(person.getName().toUpperCase()); - return person; - }); + return personFuture.thenApply(person -> new Person(person.getName().toUpperCase())); } @RequestMapping("/mono-capitalize") public Mono monoCapitalize(@RequestBody Mono personFuture) { - return personFuture.map(person -> { - person.setName(person.getName().toUpperCase()); - return person; - }); + return personFuture.map(person -> new Person(person.getName().toUpperCase())); } @RequestMapping("/single-capitalize") public Single singleCapitalize(@RequestBody Single personFuture) { - return personFuture.map(person -> { - person.setName(person.getName().toUpperCase()); - return person; - }); + return personFuture.map(person -> new Person(person.getName().toUpperCase())); } @RequestMapping("/promise-capitalize") public Promise promiseCapitalize(@RequestBody Promise personFuture) { - return Stream.from(personFuture.map(person -> { - person.setName(person.getName().toUpperCase()); - return person; - })).promise(); + return Stream.from(personFuture.map(person -> new Person(person.getName().toUpperCase()))).promise(); } @RequestMapping("/publisher-create")