Registry / testing / powermock-core

powermock-core

JSON →
library2.0.9javamavenunverified

Various utilities for accessing internals of a class, enabling mocking of static methods, constructors, and final classes in unit tests.

<dependency> <groupId>org.powermock</groupId> <artifactId>powermock-core</artifactId> <version>2.0.9</version> </dependency>
INSTALL
IMPORT
SIG · POWERMOCK-CORE
P
powermock-core
testingjavav2.0.9
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

PrepareForTest
org.powermock.core.classloader.annotations.PrepareForTest

Annotates test class to prepare specified classes for PowerMock mocking.

import org.powermock.core.classloader.annotations.PrepareForTest; import org.junit.Test; import org.junit.runner.RunWith; import org.powermock.modules.junit4.PowerMockRunner; @RunWith(PowerMockRunner.class) @PrepareForTest({MyClass.class}) public class MyTest { @Test public void testStaticMethod() { // PowerMock enables mocking static methods } }
Debug
Known issues
breakingPowerMock requires specific JUnit runner or rule setup; incompatible with some JUnit 5 versions.
fix
Use PowerMock with JUnit 4 runner or switch to Mockito inline mock maker for JUnit 5.
affects: >=2.0.0
Upgrade
Version history
2.0.9latest on Maven
Audit
Dependencies

No dependency data recorded yet.

Agent activity
10 hits · last 30 days
node
10
Resources
powermock-core — mvn dependency:get powermock-core · libregistry