org.jtestcase.core.asserter
Class Asserter

java.lang.Object
  extended by org.jtestcase.core.asserter.Asserter

public class Asserter
extends java.lang.Object


Constructor Summary
Asserter(JTestCaseDigester digester, ComplexTypeConverter typeConverter)
           
 
Method Summary
 boolean assertParam(java.lang.String className, java.lang.String method, java.lang.String testcase, java.lang.String varName, java.lang.Object varValue, TestCaseInstance tcInstance)
           Asserts a given varible's value against its expected value by using expected action.
 MultiKeyHashtable getTestCaseAssertValues(java.lang.String className, java.lang.String method, java.lang.String testcase)
          Get all assert values for a given method and its test case value into Hashtable.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Asserter

public Asserter(JTestCaseDigester digester,
                ComplexTypeConverter typeConverter)
Method Detail

assertParam

public boolean assertParam(java.lang.String className,
                           java.lang.String method,
                           java.lang.String testcase,
                           java.lang.String varName,
                           java.lang.Object varValue,
                           TestCaseInstance tcInstance)
                    throws JTestCaseException

Asserts a given varible's value against its expected value by using expected action.

                                   
                         Following actions are defined. Expected action in data file should fall into one of them:
                         ISNULL, ISNOTNULL, EQUALS, NOTEQUALS, GT (greater than), NOTGT (not greater than), 
                         LT (less than), NOTLT (not less than), and TRUE (expression is true).
                                  
                         The expected asserting results are defined in data file like this:
                         ...
                         <asserts>
                         <assert name="var1" action="EQUALS" type="int">100</assert>
                         <assert name="var2" action="NOTNULL"/>
                         </asserts>
                         ...
 

Note: "GT" means "real value" greater than "expected value" This is similar to others.

Parameters:
varName - - name of varible. Should match the name defined in data file in /test/class/method/asserts/assert@name.
varValue - - actually value of this varible.
Returns:
boolean true if assertion is true, false elseways.
Throws:
JTestCaseException - if an internal error occurs

getTestCaseAssertValues

public MultiKeyHashtable getTestCaseAssertValues(java.lang.String className,
                                                 java.lang.String method,
                                                 java.lang.String testcase)
                                          throws JTestCaseException,
                                                 java.lang.InstantiationException,
                                                 java.lang.IllegalAccessException
Get all assert values for a given method and its test case value into Hashtable. Hashed key is assert param's name, value is String value of assert param. Key is assert param's name defined in /tests/class/method/asserts/assert@name, value is assert param's Object value with type as indecated in /test/class/method/asserts/assert@type. If not "type" specified in data file, then "String" is default type.

Returns:
MultiKeyHashtable.
Throws:
JTestCaseException - if an internal error occurs
java.lang.IllegalAccessException
java.lang.InstantiationException