From 8c2fdfd193ec19bc6ae905b20d4f5f3e131bbf74 Mon Sep 17 00:00:00 2001 From: Oleg Zhurakousky Date: Sun, 14 Oct 2018 19:43:36 -0400 Subject: [PATCH] GH-198 added multi-function validation test Added test to validate that the behavior described in GH-198 is intentional and useful especially in light og GH-208 Resolves #198 --- .../config/BeanFactoryFunctionCatalogTests.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/spring-cloud-function-context/src/test/java/org/springframework/cloud/function/context/config/BeanFactoryFunctionCatalogTests.java b/spring-cloud-function-context/src/test/java/org/springframework/cloud/function/context/config/BeanFactoryFunctionCatalogTests.java index 95153c14e..de5241060 100644 --- a/spring-cloud-function-context/src/test/java/org/springframework/cloud/function/context/config/BeanFactoryFunctionCatalogTests.java +++ b/spring-cloud-function-context/src/test/java/org/springframework/cloud/function/context/config/BeanFactoryFunctionCatalogTests.java @@ -179,6 +179,20 @@ public class BeanFactoryFunctionCatalogTests { processor.lookup("supplier|consumer|z"); } + @Test + public void composeSupplierAndMultipleFunctions() { + Supplier s = () -> "hello"; + processor.register(new FunctionRegistration<>(s, "supplier")); + Function uppercase = x -> x.toUpperCase(); + processor.register(new FunctionRegistration<>(uppercase, "uppercase")); + Function concat = x -> x + x; + processor.register(new FunctionRegistration<>(concat, "concat")); + + Supplier> f = processor.lookup("supplier|uppercase|concat"); + + assertThat(f.get().blockFirst()).isEqualTo("HELLOHELLO"); + } + protected static class Source implements Supplier { @Override