For unit testing try to use in-memory database. See https://neo4j.com/docs/java-reference/current/#tutorials-java-unit-testing