org.unitils.mock.core
Class BehaviorDefiningInvocations

java.lang.Object
  extended by org.unitils.mock.core.BehaviorDefiningInvocations

public class BehaviorDefiningInvocations
extends java.lang.Object

todo javadoc

Author:
Tim Ducheyne, Filip Neven

Field Summary
protected  java.util.List<BehaviorDefiningInvocation> behaviorDefiningInvocations
           
protected  boolean removeWhenUsed
           
 
Constructor Summary
BehaviorDefiningInvocations(boolean removeWhenUsed)
           
 
Method Summary
 void addBehaviorDefiningInvocation(BehaviorDefiningInvocation behaviorDefiningInvocation)
           
 void clear()
           
 BehaviorDefiningInvocation getMatchingBehaviorDefiningInvocation(ProxyInvocation proxyInvocation)
          First we find all behavior defining invocations that have matching argument matchers.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

removeWhenUsed

protected boolean removeWhenUsed

behaviorDefiningInvocations

protected java.util.List<BehaviorDefiningInvocation> behaviorDefiningInvocations
Constructor Detail

BehaviorDefiningInvocations

public BehaviorDefiningInvocations(boolean removeWhenUsed)
Method Detail

addBehaviorDefiningInvocation

public void addBehaviorDefiningInvocation(BehaviorDefiningInvocation behaviorDefiningInvocation)

clear

public void clear()

getMatchingBehaviorDefiningInvocation

public BehaviorDefiningInvocation getMatchingBehaviorDefiningInvocation(ProxyInvocation proxyInvocation)
First we find all behavior defining invocations that have matching argument matchers. From these matching invocations, we then count the nr of not-null (default) arguments. The result will be the invocation with the lowest number of not-null arguments. If there are multiple invocations with the same number, the first one is returned. E.g. myMethod(null, null); myMethod("a", null); The second one will be returned if the given proxy invocation has the value "a" as first argument.

Parameters:
proxyInvocation - The actual invocation to match with, not null
Returns:
The behavior defining invocation that matches best with the actual invocation, null if none found


Copyright © 2009. All Rights Reserved.