You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If PowerMockRule declaration is present in a test class, test methods annotated with @test are not executed.
Example test below passes without any warnings, while one of test methods throws NPE:
@PrepareForTest(Static.class)
public class TestCase { @rule
public PowerMockRule rule = new PowerMockRule ();
@Test
public void testMethodThatThrowsNPE() {
throw new NullPointerException();
}
}
If rule declaration is commented out, test fails as expected.
Quick debug shown that Runnable created using "evaluate()" method of PowerMockStatement is never executed. It seems, like this Runnable is intended to be executed in "Object execute(Object instance, Method method, Object... arguments)" method of ClassloaderExecutor, but it does not, because there is a check based on return type, and return type is expected to be non-void (line 61).
PowerMock Ver.: 1.3.9 (Mockito API, with dependencies)
Java: 1.6.0_21-b06
Eclipse (Helios, Build id: 20100617-1415) plugin was used to run the tests.
From Yaroslav...@gmail.com on July 16, 2010 23:42:18
If PowerMockRule declaration is present in a test class, test methods annotated with @test are not executed.
Example test below passes without any warnings, while one of test methods throws NPE:
@PrepareForTest(Static.class)
public class TestCase {
@rule
public PowerMockRule rule = new PowerMockRule ();
}
If rule declaration is commented out, test fails as expected.
Quick debug shown that Runnable created using "evaluate()" method of PowerMockStatement is never executed. It seems, like this Runnable is intended to be executed in "Object execute(Object instance, Method method, Object... arguments)" method of ClassloaderExecutor, but it does not, because there is a check based on return type, and return type is expected to be non-void (line 61).
PowerMock Ver.: 1.3.9 (Mockito API, with dependencies)
Java: 1.6.0_21-b06
Eclipse (Helios, Build id: 20100617-1415) plugin was used to run the tests.
Original issue: http://code.google.com/p/powermock/issues/detail?id=268
The text was updated successfully, but these errors were encountered: