Class Log4jMockPolicy

java.lang.Object
org.powermock.api.easymock.mockpolicies.AbstractEasyMockLogPolicyBase
org.powermock.api.easymock.mockpolicies.Log4jMockPolicy
All Implemented Interfaces:
PowerMockPolicy

public class Log4jMockPolicy extends AbstractEasyMockLogPolicyBase
A log4j mock policy. This mock policy deals with solving log4j related mocking issues. It takes care of loading all concerned log4j classes through the correct class-loader and automatically prepares and injects logger instances. This policy does the following:
  1. Prepares all log4j classes and interfaces for testing.
  2. All calls to the org.apache.log4j.Logger#getLogger(..) methods are intercepted and returns a nice mock of type org.apache.log4j.Logger.