powermock.examples.mockpolicy.policy
Class MyCustomMockPolicy

java.lang.Object
  extended by 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.


Constructor Summary
MyCustomMockPolicy()
           
 
Method Summary
 void applyClassLoadingPolicy(MockPolicyClassLoadingSettings settings)
          Add the Dependency to the list of classes that should be loaded by the mock class-loader.
 void applyInterceptionPolicy(MockPolicyInterceptionSettings settings)
          Every time the Dependency.getData() method is invoked we return a custom instance of a DataObject.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MyCustomMockPolicy

public MyCustomMockPolicy()
Method Detail

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.