tiebin-zhang / powermock

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

Parameterized tests with PowerMockRule are not working properly while mocking final classes #476

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Steps to reproduce the problem:
1. Create a simple test anootated with @RunWith(Parameterized.class);
2. Add PowerMockRule into the test class;
3. Add parameters for the test with a special method annotated with @Parameters;
4. Mock the final classes (e. g. System).

Results:
Expected - the final class is mocked.
Actual - exception appears - org.mockito.exceptions.base.MockitoException.

System information:
Apache Maven 2.2.1 (r801777; 2009-08-06 22:16:01+0300)
Java version: 1.6.0_35
Java home: C:\Program Files\Java\jdk1.6.0_35\jre
Default locale: ru_RU, platform encoding: Cp1251
OS name: "windows 7" version: "6.1" arch: "amd64" Family: "windows"

Please, see the attached file for all other information (e. g., PowerMock 
version) and a sample test project.

There are two test-classes: 
"ATest"-class works as expected.
"BTest"-class fails while mocking "java.lang.System"-class.

Original issue reported on code.google.com by ivprokop...@gmail.com on 10 Jan 2014 at 1:25