What steps will reproduce the problem?
1. Create the following test class (also see attachment):
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
@RunWith(PowerMockRunner.class)
@PrepareForTest
public class TestAssertionErrorRethrownTest {
@Test(expected = AssertionError.class)
public void testSomething() {
assert false;
}
}
2. Run the test with the -ea JVM switch.
What is the expected output? What do you see instead?
I expect the test to pass. Instead, I see the following message:
testSomething(TestAssertionErrorRethrownTest): Expected exception: java.lang.AssertionError
What version of the product are you using? On what operating system?
Relevant POM file dependencies:
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
<version>1.4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito</artifactId>
<version>1.4.11</version>
<scope>test</scope>
</dependency>
Please provide any additional information below.
Commenting out the (normally useful, i.e. with classes to prepare)
@PrepareForTest annotation makes the test succeed.
Original issue reported on code.google.com by drvdijk on 12 Mar 2012 at 11:20
Original issue reported on code.google.com by
drvdijk
on 12 Mar 2012 at 11:20Attachments: