Ensure composite wrapper type reflects reality

When a Supplier<Flux<Foo>> is composed with a Function<Foo,Bar>
the resulting handler (supplier) should have Flux as its output
wrapper still (the most general output wrapper type in the chain).
This commit is contained in:
Dave Syer
2018-03-16 08:30:33 -04:00
parent 47f86671ca
commit 773dddbe68
5 changed files with 72 additions and 11 deletions

View File

@@ -33,8 +33,8 @@ public class SampleApplication {
}
@Bean
public Supplier<Flux<Bar>> words() {
return () -> Flux.fromArray(new Bar[] { new Bar("foo"), new Bar("bar") }).log();
public Supplier<Flux<Foo>> words() {
return () -> Flux.fromArray(new Foo[] { new Foo("foo"), new Foo("bar") }).log();
}
public static void main(String[] args) throws Exception {

View File

@@ -51,6 +51,13 @@ public class SampleApplicationTests {
String.class)).isEqualTo("[{\"value\":\"FOO\"}]");
}
@Test
public void composite() {
assertThat(new TestRestTemplate()
.getForObject("http://localhost:" + port + "/words,uppercase", String.class))
.isEqualTo("[{\"value\":\"FOO\"},{\"value\":\"BAR\"}]");
}
@Test
public void single() {
assertThat(new TestRestTemplate().postForObject(