Skip to content

Commit

Permalink
Fix test failures
Browse files Browse the repository at this point in the history
  • Loading branch information
pontusmelke committed Dec 18, 2017
1 parent c236b30 commit 7dbe20c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
Expand Up @@ -24,11 +24,13 @@
import org.junit.runner.Description; import org.junit.runner.Description;
import org.junit.runners.model.Statement; import org.junit.runners.model.Statement;


import java.util.function.Supplier;

public class CursorsClosedPostCondition implements TestRule public class CursorsClosedPostCondition implements TestRule
{ {
private ManagedTestCursors cursors; private Supplier<ManagedTestCursors> cursors;


CursorsClosedPostCondition( ManagedTestCursors c ) CursorsClosedPostCondition( Supplier<ManagedTestCursors> c )
{ {
this.cursors = c; this.cursors = c;
} }
Expand All @@ -41,7 +43,7 @@ public Statement apply( Statement base, Description description )
public void evaluate() throws Throwable public void evaluate() throws Throwable
{ {
base.evaluate(); base.evaluate();
cursors.assertAllClosedAndReset(); // only done if test succeeds cursors.get().assertAllClosedAndReset(); // only done if test succeeds
} }
}; };
} }
Expand Down
Expand Up @@ -91,7 +91,7 @@ public void setupGraph() throws IOException, KernelException
} }


@Rule @Rule
public CursorsClosedPostCondition cursorsClosedPostCondition = new CursorsClosedPostCondition( cursors ); public CursorsClosedPostCondition cursorsClosedPostCondition = new CursorsClosedPostCondition( () -> cursors );


@After @After
public void closeTransaction() throws Exception public void closeTransaction() throws Exception
Expand Down
Expand Up @@ -54,7 +54,7 @@ public abstract class KernelAPIWriteTestBase<WriteSupport extends KernelAPIWrite
protected static GraphDatabaseService graphDb; protected static GraphDatabaseService graphDb;


@Rule @Rule
public CursorsClosedPostCondition conditionalTeardown = new CursorsClosedPostCondition( cursors ); public CursorsClosedPostCondition conditionalTeardown = new CursorsClosedPostCondition( () -> cursors );


/** /**
* Creates a new instance of WriteSupport, which will be used to execute the concrete test * Creates a new instance of WriteSupport, which will be used to execute the concrete test
Expand Down

0 comments on commit 7dbe20c

Please sign in to comment.