final Class<?> powerMockTestListenerArrayType = Class.forName(PowerMockTestListener[].class.getName(), false,
classLoader);
Class<?> delegateClass = Class.forName(PowerMockJUnit3RunnerDelegateImpl.class.getName(), false, classLoader);
Constructor<?> con = delegateClass.getConstructor(new Class[] { Class.class, Method[].class,
powerMockTestListenerArrayType });
final PowerMockJUnit3RunnerDelegate newDelegate = (PowerMockJUnit3RunnerDelegate) con.newInstance(new Object[] {
testClassLoadedByMockedClassLoader, methodsToTest.toArray(new Method[0]),
getPowerMockTestListenersLoadedByASpecificClassLoader(testClass, classLoader) });
newDelegate.setName(name);
return newDelegate;
}