0

I'm trying to debug my unit tests for my neo4j plugin code, but while breakpoints in the tests work fine, breakpoints in the plugin code I'm testing don't work. I'm using the neo4j test harness.

I'm setting up my plugin code like this:

    @BeforeAll
    void initializeNeo4j() {
        this.embeddedDatabaseServer = Neo4jBuilders.newInProcessBuilder()
                                                   .withDisabledServer()
                                                   .withFunction(MyPlugin.class)
                                                   .withProcedure(MyPlugin.class)
                                                   .build();

        this.driver = GraphDatabase.driver(embeddedDatabaseServer.boltURI(), driverConfig);
    }

The test itself looks like this:

    @Test
    void testSimpleJsonImport() throws IOException {
        Map<String, Object> config = getJsonFile(SIMPLETEST_DEFINITION_JSON); // breakpoint works fine
        Result initialImport = session.run("CALL myplugin.json.import($data, $config)",
                Map.ofEntries(
                        entry("data", getJsonFile(SIMPLETEST_JSON)),
                        entry("config", config)
                ));
        initialImport.consume();
    }

And the plugin code looks like this:

    @Procedure(name = "myplugin.json.import", mode = Mode.WRITE)
    public Stream<BuiltInProcedures.NodeResult> jsonImport(
            @Name("data") Map<String, Object> data,
            @Name("config") Map<String, Object> config
    ) {
        JsonAdapter adapter = new JsonAdapter(data); // breakpoint here is ignored
        ...
    }

The weird thing is, I'm pretty this used to work. I don't think I've changed anything about my setup since then, yet now it fails.

I'm using IntelliJ IDEA, and I've tried running just the specific test in the debugger from the context menu, I've tried running all the tests from the debug button at the top right, I've run the debugger from the maven lifecycle context menu, nothing works.

mcv
  • 4,217
  • 6
  • 34
  • 40

0 Answers0