i am a newbie of power mock, i am actually facing a few set of issues when i included power mock into my application.
I am using
mockito(mockito-all-1.8.5.jar) and i included the compitable version of power mock for this(powermock-mockito-1.4.9-full and its dependencies) when i run the
test mocking a static class and individually running the test through eclipse
IDE the test are running fine and as expected.
But when i run cumulatively all the tests by using
ant i am facing an error
If you can observe the errors are being showed as test case which i h've not included in my test suit
Test mechanism Error java.lang.ClassNotFoundException: org.mockito.internal.progress.ThreadSafeMockingProgress
the trace is
[junit] Testcase: Test mechanism: Caused an ERROR
[junit] java.lang.ClassNotFoundException: org.mockito.internal.progress.ThreadSafeMockingProgress
[junit] java.lang.RuntimeException: java.lang.ClassNotFoundException: org.mockito.internal.progress.ThreadSafeMockingProgress
[junit] at org.powermock.api.support.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:52)
[junit] at org.powermock.api.support.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:26)
[junit] at org.powermock.api.mockito.internal.mockcreation.MockCreator$MockitoStateCleaner.clearThreadLocalIn(MockCreator.java:157)
[junit] at org.powermock.api.mockito.internal.mockcreation.MockCreator$MockitoStateCleaner.clearMockProgress(MockCreator.java:148)
[junit] at org.powermock.api.mockito.internal.mockcreation.MockCreator$MockitoStateCleaner.run(MockCreator.java:143)
[junit] at org.powermock.core.MockRepository.clear(MockRepository.java:121)
[junit] at org.powermock.reflect.internal.WhiteboxImpl.performMethodInvocation(WhiteboxImpl.java:2014)
[junit] at org.powermock.reflect.internal.WhiteboxImpl.doInvokeMethod(WhiteboxImpl.java:885)
[junit] at org.powermock.reflect.internal.WhiteboxImpl.invokeMethod(WhiteboxImpl.java:859)
[junit] at org.powermock.reflect.Whitebox.invokeMethod(Whitebox.java:466)
[junit] at org.powermock.modules.junit4.common.internal.impl.PowerMockJUnit4RunListener.testFinished(PowerMockJUnit4RunListener.java:55)
[junit] at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.invokeTestMethod(PowerMockJUnit44RunnerDelegateImpl.java:207)
[junit] at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.runMethods(PowerMockJUnit44RunnerDelegateImpl.java:146)
[junit] at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl$1.run(PowerMockJUnit44RunnerDelegateImpl.java:120)
[junit] at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.run(PowerMockJUnit44RunnerDelegateImpl.java:118)
[junit] at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.run(JUnit4TestSuiteChunkerImpl.java:102)
[junit] at org.powermock.modules.junit4.common.internal.impl.AbstractCommonPowerMockRunner.run(AbstractCommonPowerMockRunner.java:53)
[junit] at org.eclipse.ant.internal.launching.remote.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
[junit] at org.eclipse.ant.internal.launching.remote.InternalAntRunner.run(InternalAntRunner.java:423)
[junit] at org.eclipse.ant.internal.launching.remote.InternalAntRunner.main(InternalAntRunner.java:137)
[junit] Caused by: java.lang.ClassNotFoundException: org.mockito.internal.progress.ThreadSafeMockingProgress
[junit] at java.lang.Class.forName0(Native Method)
[junit] at java.lang.Class.forName(Class.java:247)
[junit] at org.powermock.api.support.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:50)
the above error is only for the first test suit(power mock uesd in this) which the compiler comes across, but runs all the test cases in that suit as expected. The remaining test suits with power mock used are not getting any test being run but facing the following error.
initializationError Error java.lang.ClassNotFoundException: org.mockito.internal.progress.ThreadSafeMockingProgress
the trace is
[junit] Testcase: initializationError(com.cscinfo.pb.web.action.myDocuments.UploadMatterDocumentActionTest): Caused an ERROR
[junit] java.lang.ClassNotFoundException: org.mockito.internal.progress.ThreadSafeMockingProgress
[junit] java.lang.RuntimeException: java.lang.ClassNotFoundException: org.mockito.internal.progress.ThreadSafeMockingProgress
[junit] at org.powermock.api.support.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:52)
[junit] at org.powermock.api.support.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:26)
[junit] at org.powermock.api.mockito.internal.mockcreation.MockCreator$MockitoStateCleaner.clearThreadLocalIn(MockCreator.java:157)
[junit] at org.powermock.api.mockito.internal.mockcreation.MockCreator$MockitoStateCleaner.clearMockProgress(MockCreator.java:148)
[junit] at org.powermock.api.mockito.internal.mockcreation.MockCreator$MockitoStateCleaner.run(MockCreator.java:143)
[junit] at org.powermock.core.MockRepository.clear(MockRepository.java:121)
[junit] at org.powermock.modules.junit4.common.internal.impl.AbstractCommonPowerMockRunner.<init>(AbstractCommonPowerMockRunner.java:42)
[junit] at org.powermock.modules.junit4.PowerMockRunner.<init>(PowerMockRunner.java:26)
[junit] at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
[junit] at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
[junit] at org.eclipse.ant.internal.launching.remote.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
[junit] at org.eclipse.ant.internal.launching.remote.InternalAntRunner.run(InternalAntRunner.java:423)
[junit] at org.eclipse.ant.internal.launching.remote.InternalAntRunner.main(InternalAntRunner.java:137)
[junit] Caused by: java.lang.ClassNotFoundException: org.mockito.internal.progress.ThreadSafeMockingProgress
[junit] at java.lang.Class.forName0(Native Method)
[junit] at java.lang.Class.forName(Class.java:247)
[junit] at org.powermock.api.support.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:50)