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

Author:
Filip Neven, Tim Ducheyne, Kenny Claes

Field Summary
protected  List<ArgumentMatcher> argumentMatchers
           
protected  MockBehavior mockBehavior
           
 
Constructor Summary
BehaviorDefiningInvocation(ProxyInvocation proxyInvocation, MockBehavior mockBehavior, List<ArgumentMatcher> argumentMatchers)
          Creates a behavior defining invocation for the given prosy invocation.
 
Method Summary
 MockBehavior getMockBehavior()
           
 int 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
 

Field Detail

argumentMatchers

protected List<ArgumentMatcher> argumentMatchers

mockBehavior

protected MockBehavior mockBehavior
Constructor Detail

BehaviorDefiningInvocation

public BehaviorDefiningInvocation(ProxyInvocation proxyInvocation,
                                  MockBehavior mockBehavior,
                                  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

getMockBehavior

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

setMockBehavior

public void setMockBehavior(MockBehavior mockBehavior)
Parameters:
mockBehavior - The behavior to execute, not null

matches

public int 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:
A matching score for the invocation, -1 if there is no match


Copyright © 2011. All Rights Reserved.