org.unitils.mock.core
Class BehaviorDefiningInvocations

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

public class BehaviorDefiningInvocations
extends Object

Author:
Tim Ducheyne, Filip Neven

Field Summary
protected  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 and take the one with the highest matching score (identity match scores higher than an equals match).
 
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 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 and take the one with the highest matching score (identity match scores higher than an equals match). If there are 2 invocations with the same score, we take the invocation with the lowest nr of not-null (default) arguments. If both have the same nr of not-null arguments, 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 © 2011. All Rights Reserved.