GH-768 Modified test to try to force the issue
This commit is contained in:
@@ -647,8 +647,10 @@ public class BeanFactoryAwareFunctionRegistryTests {
|
|||||||
FunctionCatalog catalog = this.configureCatalog(SCF_GH_768ConfigurationAsFunction.class);
|
FunctionCatalog catalog = this.configureCatalog(SCF_GH_768ConfigurationAsFunction.class);
|
||||||
Function function = catalog.lookup("echo");
|
Function function = catalog.lookup("echo");
|
||||||
|
|
||||||
String result = (String) function.apply("{\"ricky\":{\"name\":\"ricky\"}}");
|
JsonMapper mapper = this.context.getBean(JsonMapper.class);
|
||||||
assertThat(result).isEqualTo("{ricky=Person: ricky/0}");
|
String date = mapper.toString(new Date());
|
||||||
|
String result = (String) function.apply("{\"date\":" + date + "}");
|
||||||
|
assertThat(result).startsWith("{date=");
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||||
@@ -1131,12 +1133,12 @@ public class BeanFactoryAwareFunctionRegistryTests {
|
|||||||
@EnableAutoConfiguration
|
@EnableAutoConfiguration
|
||||||
public static class SCF_GH_768ConfigurationAsFunction {
|
public static class SCF_GH_768ConfigurationAsFunction {
|
||||||
@Bean
|
@Bean
|
||||||
public Function<Map<String, Person>, String> echoToString() {
|
public Function<Map<String, Date>, String> echoToString() {
|
||||||
return persons -> {
|
return data -> {
|
||||||
for (Entry<String, Person> entry : persons.entrySet()) {
|
for (Entry<String, Date> dataEntry : data.entrySet()) {
|
||||||
assertThat(entry.getValue().getName()).isNotEmpty(); // would fail if value would not be converted to Person
|
assertThat(dataEntry.getValue()).isInstanceOf(Date.class); // would fail if value would not be converted to Person
|
||||||
}
|
}
|
||||||
return persons.toString();
|
return data.toString();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user