sujithps / powermock

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

powermock not working in IntelliJ but working in eclipse #527

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.create a static method
2.write to  unit test by using powerMockito
3.not working in IntelliJ but working in eclipse

What is the expected output? What do you see instead?
Expected output was that test case runs successfully.But instead null pointer 
is thrown as powermock is unable to mock the class

What version of the product are you using? On what operating system?
IntelliJ,grails 2.2,jdk 1.6 and powermock:powermock-api-mockito:1.5

Please provide any additional information below.

Original issue reported on code.google.com by goldbric...@gmail.com on 28 Nov 2014 at 7:28

GoogleCodeExporter commented 8 years ago
i am getting this error only in IntelliJ:Misplaced argument matcher detected 
here:

-> at 
com.beachbody.pioneer.service.mediaBuy.MockTest.staticMockingExampleClassTest(Mo
ckTest.java:51)

You cannot use argument matchers outside of verification or stubbing.
Examples of correct usage of argument matchers:
    when(mock.get(anyInt())).thenReturn(null);
    doThrow(new RuntimeException()).when(mock).someVoidMethod(anyObject());
    verify(mock).someMethod(contains("foo"))

Also, this error might show up because you use argument matchers with methods 
that cannot be mocked.
Following methods *cannot* be stubbed/verified: 
final/private/equals()/hashCode().

Original comment by goldbric...@gmail.com on 28 Nov 2014 at 7:35

Attachments: