当我想在 setUp() 方法中创建 GraphDatabaseService 时,如下所示:
private GraphDatabaseService graphDb;
@BeforeMethod
public void setUp() throws Exception {
graphDb = new TestGraphDatabaseFactory().newImpermanentDatabase();
}
我得到错误:
java.lang.AbstractMethodError: org.neo4j.test.impl.EphemeralFileSystemAbstraction.autoCreatePath(Ljava/io/File;)V
at org.neo4j.kernel.StoreLocker.lock(StoreLocker.java:73)
at org.neo4j.kernel.InternalAbstractGraphDatabase.create(InternalAbstractGraphDatabase.java:287)
at org.neo4j.kernel.InternalAbstractGraphDatabase.run(InternalAbstractGraphDatabase.java:227)
at org.neo4j.kernel.EmbeddedGraphDatabase.<init>(EmbeddedGraphDatabase.java:79)
at org.neo4j.test.ImpermanentGraphDatabase.<init>(ImpermanentGraphDatabase.java:78)
at org.neo4j.test.TestGraphDatabaseFactory$1.newDatabase(TestGraphDatabaseFactory.java:46)
at org.neo4j.graphdb.factory.GraphDatabaseBuilder.newGraphDatabase(GraphDatabaseBuilder.java:205)
at org.neo4j.test.TestGraphDatabaseFactory.newImpermanentDatabase(TestGraphDatabaseFactory.java:36)
at pl.piotr0123456.neo4j.operations.GraphOperationsTest.setUp(GraphOperationsTest.java:29)
作为解决方法,我使用:
graphDb = new TestGraphDatabaseFactory().newEmbeddedDatabase("target/testGraph/test1");
带有事务回滚。但我认为这不是一个好的解决方案。
是否可以为内存中的每个单元测试清洁图创建?