Class Slf4jMockPolicy

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

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