bsugitayasa / powermock

Automatically exported from code.google.com/p/powermock
Apache License 2.0
0 stars 0 forks source link

powermock @RunWith(PowerMockRunner.class) cause classNotFoundException #436

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi,

I am using PowerMock to mock static object.
When I am running a test in Eclipse everything is fine, but running it via ANT 
(Junit) on my Linux Sabayon I get the following (I get it even when only 
adding: @RunWith(PowerMockRunner.class)):

java.lang.RuntimeException: Internal error in PowerMock
    at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.runMethods(PowerMockJUnit44RunnerDelegateImpl.java:141)
    at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl$1.run(PowerMockJUnit44RunnerDelegateImpl.java:122)
    at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.run(PowerMockJUnit44RunnerDelegateImpl.java:120)
    at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.run(JUnit4TestSuiteChunkerImpl.java:102)
    at org.powermock.modules.junit4.common.internal.impl.AbstractCommonPowerMockRunner.run(AbstractCommonPowerMockRunner.java:53)
    at org.powermock.modules.junit4.PowerMockRunner.run(PowerMockRunner.java:42)
Caused by: java.lang.ClassNotFoundException: com.oversi.vcache.ttt
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.runMethods(PowerMockJUnit44RunnerDelegateImpl.java:138)

Original issue reported on code.google.com by klein...@gmail.com on 18 Mar 2013 at 3:35

GoogleCodeExporter commented 9 years ago
This is most likely a classpath issue since it works in Eclipse. Please 
investigate your classpath to find the difference.

Original comment by johan.ha...@gmail.com on 26 Mar 2013 at 7:49