Simplified support for implicit functions in composition

added test for namless Supplier | Function
This commit is contained in:
Oleg Zhurakousky
2019-02-28 22:23:02 +01:00
parent 138e1cf3c2
commit 5b18fd7b3c
2 changed files with 44 additions and 58 deletions

View File

@@ -103,6 +103,24 @@ public class InMemoryFunctionCatalogTests {
assertThat(lookedUpFunction.get().blockFirst()).isEqualTo("olleh");
}
@Test
public void testFunctionCompletelyImplicitComposition() {
FunctionRegistration<Words> wordsRegistration = new FunctionRegistration<>(
new Words(), "words").type(FunctionType.of(Words.class));
FunctionRegistration<Reverse> reverseRegistration = new FunctionRegistration<>(
new Reverse(), "reverse").type(FunctionType.of(Reverse.class));
InMemoryFunctionCatalog catalog = new InMemoryFunctionCatalog();
catalog.register(wordsRegistration);
catalog.register(reverseRegistration);
// There's only one function, we should be able to leave that blank
Supplier<Flux<String>> lookedUpFunction = catalog.lookup("|");
assertThat(catalog.getFunctionType("|").isMessage()).isFalse();
assertThat(lookedUpFunction).isNotNull();
assertThat(lookedUpFunction.get().blockFirst()).isEqualTo("olleh");
}
@Test
public void testFunctionCompositionExplicit() {
FunctionRegistration<Words> wordsRegistration = new FunctionRegistration<>(