Add test for priority of looking up supplier in GET mapping
This commit is contained in:
@@ -211,6 +211,11 @@ public class RestApplicationTests {
|
|||||||
assertThat(rest.getForObject("/wrap/123", String.class)).isEqualTo("..123..");
|
assertThat(rest.getForObject("/wrap/123", String.class)).isEqualTo("..123..");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void supplierFirst() {
|
||||||
|
assertThat(rest.getForObject("/not/a/function", String.class)).isEqualTo("hello");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void convertGetJson() throws Exception {
|
public void convertGetJson() throws Exception {
|
||||||
assertThat(rest
|
assertThat(rest
|
||||||
@@ -232,14 +237,12 @@ public class RestApplicationTests {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void uppercaseJsonStream() throws Exception {
|
public void uppercaseJsonStream() throws Exception {
|
||||||
assertThat(
|
assertThat(rest
|
||||||
rest.exchange(
|
.exchange(RequestEntity.post(new URI("/maps"))
|
||||||
RequestEntity.post(new URI("/maps"))
|
.contentType(MediaType.APPLICATION_JSON)
|
||||||
.contentType(MediaType.APPLICATION_JSON)
|
// TODO: make this work without newline separator
|
||||||
// TODO: make this work without newline separator
|
.body("{\"value\":\"foo\"}\n{\"value\":\"bar\"}"), String.class)
|
||||||
.body("{\"value\":\"foo\"}\n{\"value\":\"bar\"}"),
|
.getBody()).isEqualTo("{\"value\":\"FOO\"}{\"value\":\"BAR\"}");
|
||||||
String.class).getBody())
|
|
||||||
.isEqualTo("{\"value\":\"FOO\"}{\"value\":\"BAR\"}");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -311,6 +314,16 @@ public class RestApplicationTests {
|
|||||||
return () -> Flux.fromIterable(Collections.emptyList());
|
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
|
@Bean
|
||||||
public Supplier<Flux<String>> timeout() {
|
public Supplier<Flux<String>> timeout() {
|
||||||
return () -> Flux.create(emitter -> {
|
return () -> Flux.create(emitter -> {
|
||||||
|
|||||||
Reference in New Issue
Block a user