Win a copy of Rust Web Development this week in the Other Languages forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

PowerMock Test mechanism error

 
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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)


 
Greenhorn
Posts: 22
Android Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I need your code to solve your problem

Thanks
 
saipraneeth nallapareddy
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks for your reply but i have resolved it myself, it is due to other jar conflicts, the app basically a web app so there were other jars which led to those errors.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi saipraneeth

Do you remember which jar file was causing this issue?

Thanks
 
He's giving us the slip! Quick! Grab this tiny ad!
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic