Thoppan / powermock

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

PowerMock.verifyStatic incorrectly verifies non intended method #342

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
    1. PowerMockito.mockStatic(MyClass.class);
    2. Call static method X twice and Y one
    3. call PowerMockito.verifyStatic();
   4. Call MyClass.Y()

What is the expected output? What do you see instead?

    Expect it to verify that Y was called once but instead get an excpetion about X being called once when expecting twice. 

    In particular I see TooManyActualInvocations with "Wanted 1 time but was 2 times"

What version of the product are you using? On what operating system?
    PowerMock version 1.8.5 on Windows XP in Java 1.6

Please provide any additional information below.
    The documentation on the wiki around mocking static method with Mockito seems to be outdated and I had to go to the JavaDocs to get the needed info. This also seems to be related to http://stackoverflow.com/questions/5285734/powermock-mockito-verify-static-method.

Original issue reported on code.google.com by CyrusOm...@gmail.com on 18 Aug 2011 at 3:55

GoogleCodeExporter commented 9 years ago
I wish I could edit my own submitted issues. Anyway this should be updated...

Expect it to verify that Y was called once but instead get an excpetion about X 
being called once when expecting twice. 

to 

Expect it to verify that Y was called once but instead get an excpetion about X 
being called twice when expecting once.

Along with other grammar errors :)

Original comment by CyrusOm...@gmail.com on 18 Aug 2011 at 3:58

GoogleCodeExporter commented 9 years ago
Seems like a bug indeed. Could you please provide a code example that 
demonstrates it? A patch would of course be nice as well :)

Original comment by johan.ha...@gmail.com on 21 Aug 2011 at 9:32