net.sourceforge.sqlunit.matchers
Class PercentageRangeMatcher

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

public class PercentageRangeMatcher
extends java.lang.Object
implements IMatcher

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

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

Constructor Summary
PercentageRangeMatcher()
          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

PercentageRangeMatcher

public PercentageRangeMatcher()
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.