Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.10
-
None
Description
while trying to port JUnitCoreProvider to tycho, I noticed that it fails with an NPE when run inside an OSGi environment.
The root cause is really JUnit bug
https://github.com/KentBeck/junit/issues/364
JUnit uses Class.forName() to load the test class which assumes the JUnit classloader can always load test classes, which is not true in an OSGi classloader environment.
While this should be fixed in JUnit, it's easy to work around this issue in surefire.
It's not necessary to use the offending org.junit.runner.Description.getTestClass() in JUnitCoreRunListener.fillTestCountMap(). We can use String getClassName() instead to circumvent classloading issues as we only need the class name anyway.
I will attach a patch.