net.sourceforge.hiveutils.test
Class SaveConstraint

java.lang.Object
  extended by net.sourceforge.hiveutils.test.SaveConstraint
All Implemented Interfaces:
org.jmock.core.Constraint, org.jmock.core.SelfDescribing

public class SaveConstraint
extends java.lang.Object
implements org.jmock.core.Constraint

jMock Constraint that just retains the value passed to it, and optionnally evaluates another Constraint on that value.

Author:
Jean-Francois Poilpret

Field Summary
protected  java.lang.Object _arg
           
protected  org.jmock.core.Constraint _inner
           
 
Constructor Summary
SaveConstraint()
          Constructor creating a constraint to save the evaluated argument without any additional check on that value.
SaveConstraint(org.jmock.core.Constraint inner)
          Constructor creating a constraint to save the evaluated argument and evaluating any additional check on that value.
 
Method Summary
 java.lang.StringBuffer describeTo(java.lang.StringBuffer buffer)
           
 boolean eval(java.lang.Object o)
           
 java.lang.Object getArgument()
          Return the last value saved in this constraint.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_inner

protected final org.jmock.core.Constraint _inner

_arg

protected java.lang.Object _arg
Constructor Detail

SaveConstraint

public SaveConstraint()
Constructor creating a constraint to save the evaluated argument without any additional check on that value.


SaveConstraint

public SaveConstraint(org.jmock.core.Constraint inner)
Constructor creating a constraint to save the evaluated argument and evaluating any additional check on that value.

Parameters:
inner - the Constraint to be evaluated on the value
Method Detail

getArgument

public java.lang.Object getArgument()
Return the last value saved in this constraint.

Returns:
the last value saved in this constraint, or null if no value was saved

eval

public boolean eval(java.lang.Object o)
Specified by:
eval in interface org.jmock.core.Constraint

describeTo

public java.lang.StringBuffer describeTo(java.lang.StringBuffer buffer)
Specified by:
describeTo in interface org.jmock.core.SelfDescribing