se.mockachino
Class MockData<T>

java.lang.Object
  extended by se.mockachino.MockData<T>

public class MockData<T>
extends java.lang.Object


Constructor Summary
MockData(java.lang.Class<T> iface, java.lang.reflect.Type type, java.util.Set<java.lang.Class<?>> extraInterfaces, java.lang.String name)
           
 
Method Summary
 Invocation addCall(java.lang.Object obj, MockachinoMethod method, java.lang.Object[] args, java.lang.StackTraceElement[] stackTrace)
          Add a call on the mock.
 void deleteLastInvocation()
           
 java.lang.Iterable<Invocation> getCalls(MockPoint start, MockPoint end)
          Gets a list of all the method invocations made for the mock object between (inclusive) two points in time.
 java.util.Set<java.lang.Class<?>> getExtraInterfaces()
          Get the set of additionally implemented interfaces by the mock.
 java.lang.Class<T> getInterface()
          Get the interface of the mock
 java.lang.Iterable<Invocation> getInvocations()
          Gets a list of all the method invocations made for the mock object
 java.util.Set<MockachinoMethod> getMethods()
           
 java.lang.String getName()
           
 java.util.List<MethodObserver> getObservers(MockachinoMethod method)
          Get all observers hooked to a specific method on the mock
 MethodStubs getStubs(MockachinoMethod method)
          Get all stubs for the mock and the method
 java.lang.reflect.Type getTypeLiteral()
           
 void resetCalls()
          Clear the list of invocations
 void resetObservers()
          Remove all observers from the mock
 void resetStubs()
          Remove all stubbing on the mock
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MockData

public MockData(java.lang.Class<T> iface,
                java.lang.reflect.Type type,
                java.util.Set<java.lang.Class<?>> extraInterfaces,
                java.lang.String name)
Method Detail

getName

public java.lang.String getName()

getMethods

public java.util.Set<MockachinoMethod> getMethods()

getInvocations

public java.lang.Iterable<Invocation> getInvocations()
Gets a list of all the method invocations made for the mock object

Returns:
the list of invocations

getCalls

public java.lang.Iterable<Invocation> getCalls(MockPoint start,
                                               MockPoint end)
Gets a list of all the method invocations made for the mock object between (inclusive) two points in time.

Returns:
the list of invocations

getStubs

public MethodStubs getStubs(MockachinoMethod method)
Get all stubs for the mock and the method

Parameters:
method -
Returns:
the stubs

getObservers

public java.util.List<MethodObserver> getObservers(MockachinoMethod method)
Get all observers hooked to a specific method on the mock

Parameters:
method -
Returns:
all observers

getInterface

public java.lang.Class<T> getInterface()
Get the interface of the mock


addCall

public Invocation addCall(java.lang.Object obj,
                          MockachinoMethod method,
                          java.lang.Object[] args,
                          java.lang.StackTraceElement[] stackTrace)
Add a call on the mock. This is typically only needed to be called by Mockachino internally.

Parameters:
method -
args -
stackTrace -
Returns:
the method call which was added

resetCalls

public void resetCalls()
Clear the list of invocations


resetStubs

public void resetStubs()
Remove all stubbing on the mock


resetObservers

public void resetObservers()
Remove all observers from the mock


getExtraInterfaces

public java.util.Set<java.lang.Class<?>> getExtraInterfaces()
Get the set of additionally implemented interfaces by the mock. This may be an empty set if no other interfaces are defined.

Returns:

deleteLastInvocation

public void deleteLastInvocation()

getTypeLiteral

public java.lang.reflect.Type getTypeLiteral()