public interface PowerMockPolicy
applyClassLoadingPolicy(MockPolicyClassLoadingSettings)
tells PowerMock which classes that should be loaded and then the
applyInterceptionPolicy(MockPolicyInterceptionSettings)
is called
from the mock class-loader itself. This means you can create mocks for e.g.
final and static methods in the
applyInterceptionPolicy(MockPolicyInterceptionSettings)
which would
not have been possible otherwise.
Since mock policies can be chained subsequent policies can override behavior of a previous policy. To avoid accidental overrides it's recommended add behavior instead of setting behavior since the latter overrides all previous configurations.
Modifier and Type | Method and Description |
---|---|
void |
applyClassLoadingPolicy(MockPolicyClassLoadingSettings settings)
Apply all class-loading related policies that must be present before the
interception policies can take place.
|
void |
applyInterceptionPolicy(MockPolicyInterceptionSettings settings)
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.
|
void applyClassLoadingPolicy(MockPolicyClassLoadingSettings settings)
settings
- The settings objects where the class-loading policies can be
applied.void applyInterceptionPolicy(MockPolicyInterceptionSettings settings)
settings
- The settings objects where the interception policies can be
applied.