问题
Most examples around the Web for doing Spring integration tests with Neo4j are still on JUnit 4, and use the Neo4jRule.
How do we create a setup for Neo4j + Spring + JUnit 5?
回答1:
If you are testing on embedded, please use the Test Harness with a simple Spring Configuration.
Here are some examples:
https://medium.com/neo4j/testing-your-neo4j-based-java-application-34bef487cc3c
https://github.com/michael-simons/neo4j-sdn-ogm-tips/tree/master/examples/using-the-test-harness https://github.com/michael-simons/neo4j-sdn-ogm-tips/tree/master/examples/using-testcontainers
https://github.com/neo4j/neo4j-java-driver-spring-boot-starter/tree/master/examples/testing-with-neo4j-harness
I would have an eye on the above ^^ This and test containers will be our way forward.
Note: The @Neo4jExtension is mostly used internally by the core team and not recommended for general use.
来源:https://stackoverflow.com/questions/60557184/how-do-i-set-up-a-spring-data-neo4j-integration-test-with-junit-5-in-kotlin