Hello everyone,
I am using Powermockito 1.5 (with mockito 1.9.5), using junit4-rule-1.5. I'm mocking a static method which is checked through production code called indirectly by the test. However, when I try to set up the test, I need to create a JMenu object - however, this throws a VerifyError - I think because the method it is complaining about is static - but I am not trying to (nor want to) mock it.
My test class looks basically like this:
@PrepareForTest( {MyClassWithStaticMethod.class} )
public class tester
{
@Rule
public PowerMockRule rule = new PowerMockRule();
@Test
public void test()
{
mockStatic( MyClassWithStaticMethod .class);
when( MyClassWithStaticMethod.staticMethod(true)).thenReturn(true);
JMenuItem menuthing = new JMenu("hello");
// the rest of the test
}
}
and I get this error message when I run it....
java.lang.VerifyError: (class: javax/swing/plaf/metal/MetalLookAndFeel, method: getLayoutStyle signature: ()Ljavax/swing/LayoutStyle;) Wrong return type in function
at javax.swing.UIManager.setLookAndFeel(UIManager.java:554)
at javax.swing.UIManager.initializeDefaultLAF(UIManager.java:1317)
at javax.swing.UIManager.initialize(UIManager.java:1406)
at javax.swing.UIManager.maybeInitialize(UIManager.java:1394)
at javax.swing.UIManager.getUI(UIManager.java:980)
at javax.swing.JMenu.updateUI(JMenu.java:206)
at javax.swing.JMenuItem.init(JMenuItem.java:194)
at javax.swing.JMenuItem.<init>(JMenuItem.java:133)
at javax.swing.JMenuItem.<init>(JMenuItem.java:110)
at javax.swing.JMenu.<init>(JMenu.java:158)
Any ideas what I am doing wrong?
Thanks,
James.
--
You received this message because you are subscribed to the Google Groups "PowerMock" group.
To view this discussion on the web visit https://groups.google.com/d/msg/powermock/-/d3a8oupNBLQJ.
To post to this group, send email to powe...@googlegroups.com.
To unsubscribe from this group, send email to powermock+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/powermock?hl=en.