Showing results for 
Search instead for 
Did you mean: 

Running tests: Numeric converters not found

Graph Voyager

spring-boot-starter-data-neo4j v2.1.5.RELEASE

I'm having an issue that only occurs when running tests. It seems that none of the standard numeric value converters are available while running tests, resulting in errors like

No converter found capable of converting from type [java.lang.Long] to type [java.lang.Double]

For instance, I may have a Float value on a relationship property, but if Neo4j has this as a Long or Double, the conversion fails. This does not happen when executing normally; only while running tests.

Does this sound familiar to anyone? Thanks!


Graph Voyager

It’s a twisted rope to follow behind the Spring magic. I think it may be an autowiring issue. I see the default/main conversionService gets fully populated with converters. That appears like it should come in via Neo4jOgmEntityInstantiatorConfigurationBean, but if it doesn’t, one is synthesized:

ConversionService conversionService = conversionServiceObjectProvider
               .getIfUnique(() -> new MetaDataDrivenConversionService(metaData));

And it appears the synthesized one is used, which has an empty converters array. So that’s a better handle on What, still doesn’t explain the Why.

I put a breakpoint Neo4jOgmEntityInstantiatorConfigurationBean:38 to see this in action – which is called by an even more opaque NativeConstructorAccessorImpl and a stack tracing to BeanUtils.

When executing normally, this comes populated with 169 converters! What would be different when running tests?


I am experiencing the same issue with missing standard converters in tests. Did you find a solution in the meantime?

Nodes 2022
NODES 2022, Neo4j Online Education Summit

All the sessions of the conference are now available online