Powermock: PowerMockRunner does not apply JUnit ClassRules

Created on 9 Aug 2016  路  2Comments  路  Source: powermock/powermock

It looks like PowerMockRunner does not support @ClassRule.

it will any time be possible use ClassRules ?

look http://stackoverflow.com/questions/38772027/powermockrunner-does-not-apply-junit-classrules

bug junit

Most helpful comment

One ugly workaround is to use
@PowerMockRunnerDelegate(BlockJUnit4ClassRunner.class)

All 2 comments

Short answer, I think - no.

It's not a part of PowerMock to support rules, it's jUnit functionality. But PowerMock reloads a test class with custom class loader and looks like it is done after jUnit applies @ClassRule.

One ugly workaround is to use
@PowerMockRunnerDelegate(BlockJUnit4ClassRunner.class)

Was this page helpful?
0 / 5 - 0 ratings