Add test for priority of looking up supplier in GET mapping

This commit is contained in:
Dave Syer
2017-03-31 13:48:36 +01:00
parent cadd5546da
commit 38dcbaffff

View File

@@ -211,6 +211,11 @@ public class RestApplicationTests {
assertThat(rest.getForObject("/wrap/123", String.class)).isEqualTo("..123..");
}
@Test
public void supplierFirst() {
assertThat(rest.getForObject("/not/a/function", String.class)).isEqualTo("hello");
}
@Test
public void convertGetJson() throws Exception {
assertThat(rest
@@ -232,14 +237,12 @@ public class RestApplicationTests {
@Test
public void uppercaseJsonStream() throws Exception {
assertThat(
rest.exchange(
RequestEntity.post(new URI("/maps"))
.contentType(MediaType.APPLICATION_JSON)
// TODO: make this work without newline separator
.body("{\"value\":\"foo\"}\n{\"value\":\"bar\"}"),
String.class).getBody())
.isEqualTo("{\"value\":\"FOO\"}{\"value\":\"BAR\"}");
assertThat(rest
.exchange(RequestEntity.post(new URI("/maps"))
.contentType(MediaType.APPLICATION_JSON)
// TODO: make this work without newline separator
.body("{\"value\":\"foo\"}\n{\"value\":\"bar\"}"), String.class)
.getBody()).isEqualTo("{\"value\":\"FOO\"}{\"value\":\"BAR\"}");
}
@Test
@@ -311,6 +314,16 @@ public class RestApplicationTests {
return () -> Flux.fromIterable(Collections.emptyList());
}
@Bean("not/a/function")
public Supplier<Flux<String>> supplier() {
return () -> Flux.just("hello");
}
@Bean("not/a")
public Function<Flux<String>, Flux<String>> function() {
return input -> Flux.just("bye");
}
@Bean
public Supplier<Flux<String>> timeout() {
return () -> Flux.create(emitter -> {