GH-1204 Polishing aftre refactoring of TypeTools

This commit is contained in:
Oleg Zhurakousky
2024-11-24 18:07:40 +01:00
parent 5e179a2052
commit a3b45f4aa7
4 changed files with 7 additions and 46 deletions

View File

@@ -59,7 +59,6 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.cloud.function.context.FunctionCatalog;
import org.springframework.cloud.function.context.FunctionRegistration;
import org.springframework.cloud.function.context.FunctionRegistry;
import org.springframework.cloud.function.context.catalog.SimpleFunctionRegistry.FunctionInvocationWrapper;
import org.springframework.cloud.function.json.JsonMapper;
import org.springframework.context.ApplicationContext;
@@ -80,7 +79,6 @@ import org.springframework.util.ReflectionUtils;
import static java.util.Collections.singletonList;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.fail;
/**
*
@@ -671,46 +669,6 @@ public class BeanFactoryAwareFunctionRegistryTests {
assertThat(f.apply(Flux.just(25)).blockFirst()).isEqualTo(25);
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@Test
public void testRegisteringWithTypeThatDoesNotMatchDiscoveredType() {
FunctionCatalog catalog = this.configureCatalog(EmptyConfiguration.class);
Function func = catalog.lookup("func");
assertThat(func).isNull();
FunctionRegistry registry = (FunctionRegistry) catalog;
try {
FunctionRegistration registration = new FunctionRegistration(new MyFunction(), "a")
.type(FunctionTypeUtils.functionType(Integer.class, String.class));
registry.register(registration);
fail();
}
catch (IllegalArgumentException e) {
// good as we expect it to fail
}
//
try {
FunctionRegistration registration = new FunctionRegistration(new MyFunction(), "b")
.type(FunctionTypeUtils.functionType(String.class, Integer.class));
registry.register(registration);
fail();
}
catch (IllegalArgumentException e) {
// good as we expect it to fail
}
//
FunctionRegistration c = new FunctionRegistration(new MyFunction(), "c")
.type(FunctionTypeUtils.functionType(String.class, String.class));
registry.register(c);
//
FunctionRegistration d = new FunctionRegistration(new RawFunction(), "d")
.type(FunctionTypeUtils.functionType(Person.class, String.class));
registry.register(d);
//
FunctionRegistration e = new FunctionRegistration(new RawFunction(), "e")
.type(FunctionTypeUtils.functionType(Object.class, Object.class));
registry.register(e);
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@Test
public void testNoConversionOnInputMapIfInputIsMap() {