powermock.examples.mockpolicy.policy
Class MyCustomMockPolicy
java.lang.Object
powermock.examples.mockpolicy.policy.MyCustomMockPolicy
- All Implemented Interfaces:
- PowerMockPolicy
public class MyCustomMockPolicy
- extends Object
- implements PowerMockPolicy
A simple mock policy whose purpose is to intercept calls to
Dependency.getData()
and return a mock.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MyCustomMockPolicy
public MyCustomMockPolicy()
applyClassLoadingPolicy
public void applyClassLoadingPolicy(MockPolicyClassLoadingSettings settings)
- Add the
Dependency
to the list of classes that should be loaded
by the mock class-loader.
- Specified by:
applyClassLoadingPolicy
in interface PowerMockPolicy
- Parameters:
settings
- The settings objects where the class-loading policies can be
applied.
applyInterceptionPolicy
public void applyInterceptionPolicy(MockPolicyInterceptionSettings settings)
- Every time the
Dependency.getData()
method is invoked we return a
custom instance of a DataObject
.
- Specified by:
applyInterceptionPolicy
in interface PowerMockPolicy
- Parameters:
settings
- The settings objects where the interception policies can be
applied.
Copyright © 2007-2012. All Rights Reserved.