Error while running junit : Error starting neo4j database server at '...\data\database '

Below is the code I am using to start Neo4j database server while running Junit test. (Note the machine is WIndows 10)

Neo4jBuilders.newInProcessBuilder()
.withDisabledServer()
.withProcedure(generateLoops.class)
.withFixture (sw.toString())
.build();

It terminates with error.Below is a part of error trace.

java.lang.RuntimeException: Error starting Neo4j database server at C:\Users\ADMIN\AppData\Local\Temp\5f34f3000325d96991e8b02d689389e2\data\databases
at org.neo4j.graphdb.facade.DatabaseManagementServiceFactory.startDatabaseServer(DatabaseManagementServiceFactory.java:207)
at org.neo4j.graphdb.facade.DatabaseManagementServiceFactory.build(DatabaseManagementServiceFactory.java:163)
at org.neo4j.harness.internal.InProcessNeo4jBuilder.createNeo(InProcessNeo4jBuilder.java:50)
at org.neo4j.harness.internal.AbstractInProcessNeo4jBuilder.build(AbstractInProcessNeo4jBuilder.java:166)
at org.neo4j.harness.internal.AbstractInProcessNeo4jBuilder.build(AbstractInProcessNeo4jBuilder.java:72)

Any help will be deeply appreciated.

Regards
Ankit

Better to use testcontainers.

Otherwise @michael.simons has written a great blog post about testing with Neo4j

I went through some of blogs relating to Testcontainer, but am not able to understand how to mock or create embedded instance of database for testing.

Did you read the blog from Michael?

Either you have to use the neo4j-harness in the latest version, see the code examples there.

Or with test-containers you have an integration test of all your procedures at the end.

I am using a MAC machine.. the unit test cases are running fine while using STS ide, but gives the error (error starting Neo4j database server at ...) while trying to run the test case from terminal using mvn test