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
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.