org.unitils.mock.core
Class BehaviorDefiningInvocation

java.lang.Object
  extended by org.unitils.mock.core.proxy.ProxyInvocation
      extended by org.unitils.mock.core.BehaviorDefiningInvocation

public class BehaviorDefiningInvocation
extends ProxyInvocation

todo javadoc

Author:
Filip Neven, Tim Ducheyne, Kenny Claes

Constructor Summary
BehaviorDefiningInvocation(ProxyInvocation proxyInvocation, MockBehavior mockBehavior, java.util.List<ArgumentMatcher> argumentMatchers)
          Creates a behavior defining invocation for the given prosy invocation.
 
Method Summary
 java.util.List<ArgumentMatcher> getArgumentMatchers()
           
 MockBehavior getMockBehavior()
           
 boolean isUsed()
           
 void markAsUsed()
           
 boolean matches(ProxyInvocation proxyInvocation)
          Returns whether or not the given ProxyInvocation matches this object's predefined Method and arguments.
 void setMockBehavior(MockBehavior mockBehavior)
           
 
Methods inherited from class org.unitils.mock.core.proxy.ProxyInvocation
getArguments, getArgumentsAtInvocationTime, getInvokedAt, getInvokedAtTrace, getLineNumber, getMethod, getMockName, getNrOfNotNullArguments, getProxy, invokeOriginalBehavior
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BehaviorDefiningInvocation

public BehaviorDefiningInvocation(ProxyInvocation proxyInvocation,
                                  MockBehavior mockBehavior,
                                  java.util.List<ArgumentMatcher> argumentMatchers)
Creates a behavior defining invocation for the given prosy invocation. The argumentsAtInvocationTime should be copies (deep clones) of the arguments at the time of the invocation. This way the original values can still be used later-on even when changes occur to the original values (pass-by-value vs pass-by-reference).

Parameters:
proxyInvocation - The proxy invocation, not null
mockBehavior - The behavior to execute, not null
argumentMatchers - The argument matchers to use when matching the invocation, not null
Method Detail

getArgumentMatchers

public java.util.List<ArgumentMatcher> getArgumentMatchers()
Returns:
The argument matchers to use when matching the invocation, not null

getMockBehavior

public MockBehavior getMockBehavior()
Returns:
The behavior to execute, not null

setMockBehavior

public void setMockBehavior(MockBehavior mockBehavior)

isUsed

public boolean isUsed()
Returns:
True if this invocation was already matched and used before and should no longer be used

markAsUsed

public void markAsUsed()

matches

public boolean matches(ProxyInvocation proxyInvocation)
Returns whether or not the given ProxyInvocation matches this object's predefined Method and arguments.

Parameters:
proxyInvocation - the ProxyInvocation to match.
Returns:
true when given ProxyInvocation matches, false otherwise.


Copyright © 2009. All Rights Reserved.