GH-727 Fix Azure's Supplier<Publisher> logic to avoid NPE

Resolves #727
This commit is contained in:
Oleg Zhurakousky
2021-11-18 13:29:07 +01:00
parent eaf03ebb00
commit 6031cc83f3
2 changed files with 41 additions and 9 deletions

View File

@@ -134,6 +134,16 @@ public class FunctionInvokerTests {
assertThat(result.toString()).isEqualTo("[foo1, foo2]");
}
@Test
public void supplierPublisherBean() {
FunctionInvoker<Void, ?> handler = handler(ReactiveSupplierConfig.class);
Foo resultSingle = (Foo) handler.handleRequest(new TestExecutionContext("suppliermono"));
assertThat(resultSingle.getValue()).isEqualTo("hello");
List<Foo> resultList = (List<Foo>) handler.handleRequest(new TestExecutionContext("supplierflux"));
assertThat(resultList.size()).isEqualTo(2);
}
private static String consumerResult;
@Test
@@ -209,6 +219,22 @@ public class FunctionInvokerTests {
}
@Configuration
// @EnableAutoConfiguration
protected static class ReactiveSupplierConfig {
@Bean
public Supplier<Mono<Foo>> suppliermono() {
return () -> Mono.just(new Foo("hello"));
}
@Bean
public Supplier<Flux<Foo>> supplierflux() {
return () -> Flux.just(new Foo("hello"), new Foo("bye"));
}
}
@Configuration
protected static class BareConfig {