|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.powermock.api.mockito.mockpolicies.Slf4jMockPolicy
public class Slf4jMockPolicy
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.
| Constructor Summary | |
|---|---|
Slf4jMockPolicy()
|
|
| Method Summary | |
|---|---|
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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Slf4jMockPolicy()
| Method Detail |
|---|
public void applyClassLoadingPolicy(MockPolicyClassLoadingSettings mockPolicyClassLoadingSettings)
PowerMockPolicy
applyClassLoadingPolicy in interface PowerMockPolicymockPolicyClassLoadingSettings - The settings objects where the class-loading policies can be
applied.public void applyInterceptionPolicy(MockPolicyInterceptionSettings mockPolicyInterceptionSettings)
PowerMockPolicy
applyInterceptionPolicy in interface PowerMockPolicymockPolicyInterceptionSettings - The settings objects where the interception policies can be
applied.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||