org.jmock.core.constraint

Class IsCloseTo

Implemented Interfaces:
Constraint, SelfDescribing

public class IsCloseTo
extends Object
implements Constraint

Is the value a number equal to a value within some range of acceptable error?

Constructor Summary

IsCloseTo(double value, double error)

Method Summary

StringBuffer
describeTo(StringBuffer buffer)
boolean
eval(Object arg)
Evaluates the constraint for argument o.

Constructor Details

IsCloseTo

public IsCloseTo(double value,
                 double error)

Method Details

describeTo

public StringBuffer describeTo(StringBuffer buffer)
Specified by:
describeTo in interface SelfDescribing

eval

public boolean eval(Object arg)
Evaluates the constraint for argument o.
Specified by:
eval in interface Constraint
Parameters:
Returns:
true if o meets the constraint, false if it does not.