I am developing a neo4j plugin. So currently I am writing a neo4j procedure which calls a helper function ( present in a helper class ). A simplified snippet of the helper function is given below:
public Result runQuery(String query, Transaction tx) {
return tx.execute(query);
}
I wanted to test the helper function. I am using the Neo4j driver to spin up a database and test my helper function. But my issue is that the helper function uses the transaction from org.neo4j.graphdb.Transaction
and the transaction generated from Neo4j driver is from org.neo4j.driver.Transaction
.
Below is a snippet from the test class.
@Test
public void testRunQuery() {
try(Session session = driver.session()) {
// this is from org.neo4j.driver.Transaction
Transaction tx = session.beginTransaction();
String query = "..."
// below function accepts tx which is from org.neo4j.graphdb.Transaction
Result result = helper.runQuery(query, tx);
}
}
How do I test my function as the helper function accepts a transaction which is of a different type from what is initialized in the test function?