Testing plugin depending on apoc

I am busy developing my own java plugin for neo.
I am using maven and writing unit tests using harness, as is suggested in the tutorials..
Now, in my plugin i want to use apoc, as there are some excellent functions in there, and i plan to do it by using cypher statements.
How can i get my test instances to load the apoc procedures? As it is now i just get error messages that there are no procedure with the name apoc.X.X and i have no idea to fix that, so any help would be appreciated!


1 Like

If you already have APOC's classes in your app, you can do it the same way that APOC does it, by using its TestUtil.registerProcedure method.

Here's an example from APOC's unit tests, something very similar should work for you.

So in this testing what's happening is that you're creating a temporary in memory Neo4j instance. Much as you'd launch neo4j and need to put your plugin into the plugins directory, this temporary instance has to be told what plugin to load to accomplish your test. That's what's happening here.

thanks for the quick response, I will try that!
It does mean that i will have to download the source code and put it in my source code tree, as i understand? Its not possible to just tell it to load the apoc jar file somehow?


If you have the apoc JAR then I think you should have that class. If you don't have that class, then you can borrow the TestUtil code from APOC and still accomplish the same.