{"id":66533,"library":"powermock-module-junit4-rule-agent","title":"PowerMock JUnit4 Rule Agent","description":"PowerMock module providing JUnit 4 rule support with Java agent for mocking static methods and constructors.","status":"active","version":"2.0.9","language":"java","source_language":null,"source_url":"https://github.com/powermock/powermock","tags":["testing","mock","powermock","junit"],"install":[{"cmd":"<dependency>\n  <groupId>org.powermock</groupId>\n  <artifactId>powermock-module-junit4-rule-agent</artifactId>\n  <version>2.0.9</version>\n</dependency>","lang":"xml","label":"Maven"},{"cmd":"implementation 'org.powermock:powermock-module-junit4-rule-agent:2.0.9'","lang":"groovy","label":"Gradle"}],"dependencies":[],"imports":[{"symbol":"PowerMockRule","correct":"org.powermock.modules.junit4.rule.PowerMockRule"}],"quickstart":{"code":"import org.junit.Rule;\nimport org.junit.Test;\nimport org.powermock.modules.junit4.rule.PowerMockRule;\nimport static org.powermock.api.mockito.PowerMockito.mockStatic;\n\npublic class Quickstart {\n    @Rule\n    public PowerMockRule rule = new PowerMockRule();\n\n    @Test\n    public void testStatic() {\n        mockStatic(System.class);\n        // test logic\n    }\n}","lang":"java","description":"Uses PowerMockRule to enable mocking of static methods in JUnit 4 tests."},"warnings":[{"fix":"Use JUnit 4.12 or later, and ensure no conflicting mock frameworks.","message":"PowerMock 2.0.9 requires Java 8+ and may conflict with newer JUnit versions.","severity":"gotcha","affected_versions":">=2.0.0"}],"env_vars":null,"search_vec":"'4':9 'agent':4,14 'constructor':20 'java':13 'junit':8,24 'junit4':2 'method':18 'mock':16,22 'modul':6 'powermock':1,5,23 'provid':7 'rule':3,10 'static':17 'support':11 'test':21","created_at":"2026-06-17T17:25:01.286193+00:00","updated_at":"2026-06-17T17:25:01.286193+00:00","problems":[],"ecosystem":"maven","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"http://www.powermock.org","github":"https://github.com/powermock/powermock","docs":"https://appdoc.app/artifact/org.powermock/powermock-module-junit4-rule-agent/","changelog":null,"pypi":null,"npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-12-14","install_tag":null}}