public class Slf4jMockPolicy extends java.lang.Object implements PowerMockPolicy
org.slf4j.LoggerFactory#getLogger(Class)
. However, it is critical that the mocked logger is
reset after each test in order to avoid crosstalk between test cases.
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
FRAMEWORK_NAME |
private static java.lang.String |
LOGGER_CLASS_NAME |
private static java.lang.String |
LOGGER_FACTORY_CLASS_NAME |
private static java.lang.String |
LOGGER_FACTORY_METHOD_NAME |
private static java.lang.ThreadLocal<java.lang.Object> |
threadLogger |
Constructor and Description |
---|
Slf4jMockPolicy() |
Modifier and Type | Method and Description |
---|---|
void |
applyClassLoadingPolicy(MockPolicyClassLoadingSettings mockPolicyClassLoadingSettings)
Apply all class-loading related policies that must be present before the
interception policies can take place.
|
void |
applyInterceptionPolicy(MockPolicyInterceptionSettings mockPolicyInterceptionSettings)
Apply the interception policies, for example which methods that should be
suppressed or which methods that should be intercepted and return some
else than their original value.
|
private java.lang.Class<?> |
getLoggerClass(LogPolicySupport logPolicySupport) |
private void |
initializeMockForThread(LogPolicySupport logPolicySupport) |
private static final java.lang.String LOGGER_FACTORY_CLASS_NAME
private static final java.lang.String LOGGER_FACTORY_METHOD_NAME
private static final java.lang.String FRAMEWORK_NAME
private static final java.lang.String LOGGER_CLASS_NAME
private static java.lang.ThreadLocal<java.lang.Object> threadLogger
public void applyClassLoadingPolicy(MockPolicyClassLoadingSettings mockPolicyClassLoadingSettings)
PowerMockPolicy
applyClassLoadingPolicy
in interface PowerMockPolicy
mockPolicyClassLoadingSettings
- The settings objects where the class-loading policies can be
applied.public void applyInterceptionPolicy(MockPolicyInterceptionSettings mockPolicyInterceptionSettings)
PowerMockPolicy
applyInterceptionPolicy
in interface PowerMockPolicy
mockPolicyInterceptionSettings
- The settings objects where the interception policies can be
applied.private void initializeMockForThread(LogPolicySupport logPolicySupport)
private java.lang.Class<?> getLoggerClass(LogPolicySupport logPolicySupport)