When I try to execute the below simplified JUnit test, it succeeds but i am getting an error message: Notifications are not supported when all test-instances are created first!
@RunWith(PowerMockRunner.class)
@PowerMockRunnerDelegate(BlockJUnit4ClassRunner.class)
@PrepareForTest({ A.class })
public class TestA extends TestB {
@Test
public void test() throws Exception {
assertEquals(true, true);
}
}
public class TestB {}
public class A {}
When I remove the @PowerMockRunnerDelegate(BlockJUnit4ClassRunner.class)
, or the extends TestB
or the @PrepareForTest({ A.class })
, the message disappears. Even an emtpy @PrepareForTest({ })
makes the error message appear.
I found this post, but it is not the same problem, because I am not using an extended BlockJUnit4ClassRunner
.
I am trying to understand why this error message appears.
I am using the latest version of Powermock (1.6.6) and JUnit 4.12 and running the test using java8.