org.powermock.api.mockito.mockpolicies
Class Slf4jMockPolicy
java.lang.Object
org.powermock.api.mockito.mockpolicies.Slf4jMockPolicy
- All Implemented Interfaces:
- PowerMockPolicy
public class Slf4jMockPolicy
- extends Object
- implements PowerMockPolicy
Sfl4j mock policy that injects a Mockito-created mock to be returned on calls to getLogger factory methods.
The implementation returns a single mock instance per thread but it doesn't return a different mock instance based
on the actual value passed to getLogger. This limitation is acceptable in most real uses cases.
Tests that want to do verifications on the mocked logger can do so by getting the mocked instance as production code
does: 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.
- Author:
- Alexandre Normand
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Slf4jMockPolicy
public Slf4jMockPolicy()
applyClassLoadingPolicy
public void applyClassLoadingPolicy(MockPolicyClassLoadingSettings mockPolicyClassLoadingSettings)
- Specified by:
applyClassLoadingPolicy in interface PowerMockPolicy
applyInterceptionPolicy
public void applyInterceptionPolicy(MockPolicyInterceptionSettings mockPolicyInterceptionSettings)
- Specified by:
applyInterceptionPolicy in interface PowerMockPolicy
Copyright © 2007-2014. All Rights Reserved.