Can we create a mocked instance of java.lang.Class with PowerMock?
问题 I need to write a test that mocks a instance of the java.lang.Class class. Is this possible via PowerMock? I tried to do following: PowerMock.createMock(Class.class); And the result is: java.lang.IllegalAccessError: java.lang.Class at sun.reflect.GeneratedSerializationConstructorAccessor12.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Constructor.java:526) at org.objenesis.instantiator.sun.SunReflectionFactoryInstantiator.newInstance(SunReflectionFactoryInstantiator