net.sourceforge.sqlunit.matchers
Class ExpressionMatcher

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

public class ExpressionMatcher
extends java.lang.Object
implements IMatcher

Allows the caller to specify an expression in Apache JEXL (Java Extended Expression Language). The expression must evaluate to a boolean expression (true or false). The source and target are referenced in the expression using the pseudo-variables expected.value and actual.value.

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

Constructor Summary
ExpressionMatcher()
          Instantiate a ExpressionMatcher object
 
Method Summary
 boolean isEqual(java.lang.String source, java.lang.String target, java.util.Map args)
          Returns the result of the specified expression.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExpressionMatcher

public ExpressionMatcher()
Instantiate a ExpressionMatcher object

Method Detail

isEqual

public boolean isEqual(java.lang.String source,
                       java.lang.String target,
                       java.util.Map args)
                throws SQLUnitException
Returns the result of the specified expression. If the expression does not evaluate to either true or false, then an exception is thrown.

Specified by:
isEqual in interface IMatcher
Parameters:
source - the value of the source to match.
target - the value of the target to match.
args - any extra parameters specified as name-value pairs with embedded arg elements.
Returns:
true if the source and target are equal according to the Matcher.
Throws:
SQLUnitException - if there was a problem.