neotest-java icon indicating copy to clipboard operation
neotest-java copied to clipboard

Cannot execute nested test class

Open eruizc-dev opened this issue 2 years ago • 7 comments

When tying to execute the test below it fails stating thatapp.SomeTest.app.SomeNestedTest.* doesn't exist. That's because it should try and run app.SomeTest$SomeNestedTest.* instead.

package app;

public class SomeTest {
    public static class SomeNestedTest {
        @Test
        public void someTest() {
            assertEquals(1 + 1, 2);
        } 
    }
}

eruizc-dev avatar Nov 08 '23 18:11 eruizc-dev

I am already checking this out. Thank you for the report!

rcasia avatar Nov 08 '23 21:11 rcasia

Awesome! Let me know if you need help, I'm willing to contribute

eruizc-dev avatar Nov 08 '23 21:11 eruizc-dev

Having classes as namespaces should bring the posibility to construct the right command. I'll assing you this issue. If you need any guidance, don't hesitate to ask.

rcasia avatar Nov 09 '23 00:11 rcasia

I'm having trouble running my tests locally and it's making it difficult to see how my changes affect the project. How do you run them?

I've tried with neotest-plenary and with the barebons nvim --headless -c "PlenaryBustedDirectory ." but 2 test while loading neotest-java and the others hang. I've also inspected your CI and found that while it succeeds there are a couple hidden failures in there: https://github.com/rcasia/neotest-java/actions/runs/6805839060/job/18506092499#step:5:42

eruizc-dev avatar Nov 10 '23 12:11 eruizc-dev

Oh forget about the CI thing, I went back and noticed that those were java tests and not lua's :sweat_smile: , but I still have trouble executing the other. I do wonder if it has something to do with the way I have configured Lazy.nvim.

eruizc-dev avatar Nov 10 '23 12:11 eruizc-dev

I needed to set the absolute path to minimal_init.vim for the neotest-plenary config. Something like this:

{
    'nvim-neotest/neotest-plenary',
    min_init = ".../neotest-java/tests/minimal_init.vim"
}

Also I just created CONTRIBUTING, might be useful.

rcasia avatar Nov 10 '23 16:11 rcasia

I've just pushed a bugfix related to the newly introduced namespaces. This fix could be a starting point for addressing the issue with nested classes.

rcasia avatar Nov 13 '23 17:11 rcasia

Close this issue is currently fixed.

rcasia avatar Jun 22 '24 13:06 rcasia