net.sourceforge.sqlunit.matchers
Class RangeMatcher

java.lang.Object
  extended by net.sourceforge.sqlunit.matchers.RangeMatcher
All Implemented Interfaces:
IMatcher

public class RangeMatcher
extends java.lang.Object
implements IMatcher

The RangeMatcher is an implementation of the IMatcher interface used to define rulesets for matching columns in SQLUnit. This matcher will accept an absolute tolerance value and check to see that the target is within (+/-) tolerance of the source.

Version:
$Revision: 1.3 $
Author:
Sujit Pal (spal@users.sourceforge.net)

Constructor Summary
RangeMatcher()
          Default constructor as per contract with IMatcher.
 
Method Summary
 boolean isEqual(java.lang.String source, java.lang.String target, java.util.Map args)
          Returns true if the value of the target is withing (+/-) a specified tolerance value of the source.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RangeMatcher

public RangeMatcher()
Default constructor as per contract with IMatcher.

Method Detail

isEqual

public final boolean isEqual(java.lang.String source,
                             java.lang.String target,
                             java.util.Map args)
                      throws SQLUnitException
Returns true if the value of the target is withing (+/-) a specified tolerance value of the source. Note that in this case, the source, target and tolerance must all be numeric values.

Specified by:
isEqual in interface IMatcher
Parameters:
source - the String representing the source to be matched.
target - the String representing the target to be matched.
args - a Map of name value pairs of arguments passed in.
Returns:
true if the matching strategy resulted in success.
Throws:
SQLUnitException - if there was a problem with matching.