Tagged articles
PowerMock
14 articles · Page 1 of 1
The article demonstrates how PowerMock can be used to unit‑test a Java FileParser class—showing basic mocks for files and streams, advanced techniques for final and static classes, and achieving full coverage—while warning that its heavy class‑loader overhead can dramatically slow large test suites and increase memory consumption.
JUnitJavaMocking
0 likes · 10 min read

This article explains why upgrading JDK 11 prompts the removal of the unmaintained PowerMock framework, outlines the steps to replace it with Mockito‑Only—including JUnit runner configuration, handling static, private, and final methods, multithreaded mock limitations, and performance gains—while providing code examples and migration tips.
JDK11 migrationJava TestingMocking
0 likes · 15 min read

This article provides a step‑by‑step guide on mocking static variables and static methods in the Spock testing framework using PowerMock, covering annotation setup, custom behavior definitions, and handling mixed scenarios where both static and instance mocks are required.
Java TestingMockitoPowerMock
0 likes · 5 min read

This article walks through setting up Spock for Java/Groovy projects, lists required Maven dependencies, shows how to handle static‑method mocking with PowerMock and Mockito, and provides concrete code examples for mocking @Autowired components, shared objects, and defining mock behavior.
BackendGroovyJava
0 likes · 11 min read

The author describes encountering quality‑assurance challenges in Spring Boot, revisiting unit‑testing frameworks like Spock, Mockito, and PowerMock, struggling with static‑method mocking, and ultimately adopting a "reset and rebuild" strategy to resolve dependency conflicts and improve test coverage.
MockingMockitoPowerMock
0 likes · 5 min read

This comprehensive guide walks Java developers through the principles and practical steps of writing high‑coverage unit tests using Mockito and PowerMock, covering framework basics, Maven dependencies, typical service code, test case structure, mocking techniques, verification methods, exception handling, and common pitfalls with solutions.
JavaMockingMockito
0 likes · 44 min read

This comprehensive guide walks you through writing effective Java unit tests, covering test framework basics, Maven dependencies, typical code examples, step‑by‑step test case creation, mocking techniques with Mockito and PowerMock, verification strategies, handling special cases, and best practices for achieving high coverage.
JUnitJavaMocking
0 likes · 48 min read

This article explains unit testing concepts, introduces TestNG and PowerMock frameworks for Spring Boot, details common annotations, provides Maven dependency snippets and comprehensive Java test examples, and demonstrates advanced mocking techniques, parameterized tests, and assertion strategies to improve code reliability and coverage.
JavaMockingPowerMock
0 likes · 14 min read

This comprehensive guide walks Java developers through setting up PowerMock and Mockito, demonstrates creating and spying on mocks, stubbing methods, using parameter matchers, verifying interactions—including static and private members—and explains essential annotations and best‑practice principles for robust, maintainable unit tests.
JavaMockingMockito
0 likes · 24 min read

This article explains how to simplify complex Java code by using PowerMock and Mockito for unit testing, covering environment setup, mock, spy, when, parameter matchers, verification, static method mocking, private field and method handling, and essential annotations with practical code examples.
JavaMockitoPowerMock
0 likes · 26 min read

TestableMock is a lightweight Java mock testing tool that eliminates initialization and framework dependencies, allowing any method—including private, static, or constructor—to be replaced with a single @MockMethod annotation, dramatically simplifying unit test development.
JMockitJavaMock testing
0 likes · 13 min read

This guide explains why unit testing matters, compares Java testing tools, introduces PowerMock’s capabilities, details essential annotations, shows how to configure dependencies, and provides step‑by‑step code examples for mocking public, final, static, private, constructor, field and superclass methods.
JUnitJavaMocking
0 likes · 10 min read

This article explains the fundamentals of unit testing in Java, covering what unit tests are, why they matter, when to write them, and detailed step‑by‑step examples using Mockito, PowerMock, JUnit, and Spring Boot to mock dependencies, verify behavior, and assert results across DAO, service, and controller layers.
JUnitMockingMockito
0 likes · 28 min read

This article explains Youzan’s layered unit‑testing framework for microservice applications, outlines typical pain points such as massive test‑case rewrites, unstable test data, and missing result verification, and demonstrates how tools like DbUnit, H2, springockito, spring‑test and PowerMock are combined to provide data preparation, mock injection, automatic cleanup, and declarative result checks.
DbUnitJavaMockito
0 likes · 13 min read
