aspose file tools*
The moose likes Java in General and the fly likes Help me in mocking static functions with testng powermock and easymock Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Help me in mocking static functions with testng powermock and easymock" Watch "Help me in mocking static functions with testng powermock and easymock" New topic
Author

Help me in mocking static functions with testng powermock and easymock

sumit anand kumar
Ranch Hand

Joined: Apr 28, 2010
Posts: 83
To tell you first, i have tried and tried it again and now i need some help

Heres my code


And heres the log
[Parser] Running: C:\MockWorkspace\Mock\temp-testng-customsuite.xml

got object factory print me Static method called FAILED: testMe java.lang.IllegalStateException: no last call on a mock available at org.easymock.EasyMock.getControlForLastCall(EasyMock.java:521) at org.easymock.EasyMock.expect(EasyMock.java:499) at staticPkg.TestClass.testMe(TestClass.java:46) ... Removed 22 stack frames

=============================================== staticPkg.TestClass

Tests run: 1, Failures: 1, Skips: 0
=============================================== Mock

Total tests run: 1, Failures: 1, Skips: 0
Help please, i have tried a variety of solutions, can't get it done. Please can anyone try this code and correct it for success? I get error in EasyMock.expect ...............
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Help me in mocking static functions with testng powermock and easymock
 
Similar Threads
constructors
Basic Java
what is static import
TestNG - Gettting error [ClassHelper] Could not instantiate
Access modifiers