• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

PowerMock issues

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using Mockito+TestNG framework in my Project. It is used to work fine but to mock some static methods I injected PowerMock Libraries in my classpath and updated the code to use PowerMock(libraries screenshot MockDependencies.PNG attached). I am finding that whenever I try to execute : PowerMockito.doNothing().when(CustomImportUtil.class, "init", serviceMgr);
test case fails while initializing mockobject [s = mock(Service.class);] with error message :

-------------------------------------
Below is my sample java test class. Kindly help me to resolve this issue.

----------



MockDependencies.PNG
[Thumbnail for MockDependencies.PNG]
Description of mock jars and TestNG framework
 
Sheriff
Posts: 5555
326
IntelliJ IDE Python Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Nitesh, welcome to the Ranch!

I moved your post into our Testing forum to help you get the right response to your question. I also added code tags to your post to make your code examples easier to read, which is another top tip to help you get your question answered. (Read --> UseCodeTags)
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic