org.opencms.flex
Class TestCmsFlexResponse.RecordingMock

java.lang.Object
  extended by org.opencms.flex.TestCmsFlexResponse.RecordingMock
All Implemented Interfaces:
InvocationHandler
Enclosing class:
TestCmsFlexResponse

public static class TestCmsFlexResponse.RecordingMock
extends Object
implements InvocationHandler

An InvocationHandler which simply records the arguments for each method that was called.

If a 'stub' object was passed in the contructor, and the stub object has a method of the same signature as the one that is being called, that method will be invoked.


Constructor Summary
TestCmsFlexResponse.RecordingMock()
          Default empty construtor.
TestCmsFlexResponse.RecordingMock(Object stub)
          Construtor with a 'stub' Object.
 
Method Summary
 List getCalls(Method method)
          Returns a list of all recorded calls to the given method.
 Object invoke(Object proxy, Method method, Object[] args)
          Notice that the given method has been invoked.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TestCmsFlexResponse.RecordingMock

public TestCmsFlexResponse.RecordingMock()
Default empty construtor.


TestCmsFlexResponse.RecordingMock

public TestCmsFlexResponse.RecordingMock(Object stub)
Construtor with a 'stub' Object.

Parameters:
stub - the stub Object to use
Method Detail

getCalls

public List getCalls(Method method)
Returns a list of all recorded calls to the given method.

Parameters:
method - the method to get the recorded calls for
Returns:
a list of all recorded calls to the given method

invoke

public Object invoke(Object proxy,
                     Method method,
                     Object[] args)
              throws Throwable
Notice that the given method has been invoked.

Two actions are taken:

  1. The invocation is recorded in getCalls(method).
  2. If m_stub is not null, the requested method is invoked on it

Specified by:
invoke in interface InvocationHandler
Throws:
Throwable
See Also:
InvocationHandler.invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])