When I try to run JUnit tests in the Eclipse IDE (right click | Run | Junit test) it now fails with the following error. It used to work fine. Can anyone please tell me what I need to change?
Error: Could not find or load main class m
Caused by: java.lang.ClassNotFoundException: m
For me the problem seems to occur only on EXISTING Junit test classes i.e. classes that were downloaded from GitHub. By contrast if I create a NEW Junit test class then it works perfectly.
So my “solution” is to create a new class and copy the test code from the existing class which then runs just fine.
I guess this means that the IDE is not importing some runtime dependencies for existing classes, but creating a new class forces them to be attached. However I have not been able to figure out the exact details…
@AndrewFG Something fishy is going on. It used to work perfectly well after a clean IDE setup, and suddenly, without any reason, it all fails. I will give your solution a go
The reason I bumped into this is that I have unit tests fail in the Github pipeline after emitting a merge request, but they are passing without problems locally using mvn. I don’t get, as this are tests that cover code that I have even not touched at all