Annotation Type PowerMockIgnore
-
@Target({TYPE,METHOD}) @Retention(RUNTIME) @Documented @Inherited public @interface PowerMockIgnoreThis annotation tells PowerMock to defer the loading of classes with the names supplied to
value()to the system classloader.For example suppose you'd like to defer the loading of all classes in the org.myproject package and all its sub-packages but you still like to prepare "MyClass" for test. Then you do like this:
@PowerMockIgnore("org.myproject.*") @PrepareForTest(MyClass.class) @RunWith(PowerMockRunner.class) public class MyTest { ... }This is useful in situations when you have e.g. a test/assertion utility framework (such as something similar to Hamcrest) whose classes must be loaded by the same classloader as EasyMock, JUnit and PowerMock etc.
Note that the
PrepareForTestandPrepareOnlyThisForTestwill have precedence over this annotation. This annotation will have precedence over thePrepareEverythingForTestannotation.Since PowerMock 1.7.0 list of packages/classes which should be loaded by the system classloader can be specified with using
PowerMockConfiguration. If you want that the test annotated byPowerMockIgnorethen setglobalIgnore()tofalse.- See Also:
ClassLoader.getSystemClassLoader(),PowerMockConfiguration
-
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description booleanglobalIgnoreSet totrueif packages from configuration should merge with list of packages/classes fromvalue().java.lang.String[]value
-