net.sf.farrago.test
Class ResultSetTestCase

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.eigenbase.test.DiffTestCase
              extended by net.sf.farrago.test.ResultSetTestCase
All Implemented Interfaces:
Test
Direct Known Subclasses:
FarragoJdbcTest, FarragoTestCase

public abstract class ResultSetTestCase
extends DiffTestCase

ResultSetTestCase (refactroed from FarragoTestCase) is a abstract base for JUnit tests (see FarragoJdbcTest) that uses result sets.

Version:
$Id: //open/dev/farrago/src/net/sf/farrago/test/ResultSetTestCase.java#13 $
Author:
Angel Chang

Field Summary
protected  ResultSet resultSet
          ResultSet for processing queries.
 
Fields inherited from class org.eigenbase.test.DiffTestCase
logFile, logOutputStream, refFile
 
Constructor Summary
protected ResultSetTestCase(String testName)
          Creates a new FarragoTestCase object.
 
Method Summary
protected  void compareResultList(List<String> refList)
          Compares the first column of a result set against a String-valued reference set, taking order into account.
protected  void compareResultLists(List<String>... refLists)
          Compares the columns of a result set against several String-valued reference lists, taking order into account.
protected  void compareResultSet(Set<String> refSet)
          Compares the first column of a result set against a String-valued reference set, disregarding order entirely.
protected  void compareResultSetWithDelta(double expected, double delta)
          Compares the first column of a result set against a numeric result, within a given tolerance.
protected  void compareResultSetWithPattern(Pattern pattern)
          Compares the first column of a result set against a pattern.
protected  int getResultSetCount()
           
 
Methods inherited from class org.eigenbase.test.DiffTestCase
addDiffMask, addIgnorePattern, diffFile, diffLines, diffTestLog, fileContents, getTestlogRoot, openTestLog, openTestLogOutputStream, setGC, setRefFileDiffMasks, setUp, setVerbose, tearDown
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame, format
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

resultSet

protected ResultSet resultSet
ResultSet for processing queries.

Constructor Detail

ResultSetTestCase

protected ResultSetTestCase(String testName)
                     throws Exception
Creates a new FarragoTestCase object.

Parameters:
testName - .
Throws:
Exception - .
Method Detail

getResultSetCount

protected int getResultSetCount()
                         throws Exception
Returns:
the number of rows in resultSet (which is consumed as a side effect)
Throws:
Exception

compareResultSet

protected void compareResultSet(Set<String> refSet)
                         throws Exception
Compares the first column of a result set against a String-valued reference set, disregarding order entirely.

Parameters:
refSet - expected results
Throws:
Exception - .

compareResultSetWithPattern

protected void compareResultSetWithPattern(Pattern pattern)
                                    throws Exception
Compares the first column of a result set against a pattern. The result set must return exactly one row.

Parameters:
pattern - Expected pattern
Throws:
Exception

compareResultSetWithDelta

protected void compareResultSetWithDelta(double expected,
                                         double delta)
                                  throws Exception
Compares the first column of a result set against a numeric result, within a given tolerance. The result set must return exactly one row.

Parameters:
expected - Expected result
delta - Tolerance
Throws:
Exception

compareResultList

protected void compareResultList(List<String> refList)
                          throws Exception
Compares the first column of a result set against a String-valued reference set, taking order into account.

Parameters:
refList - expected results
Throws:
Exception - .

compareResultLists

protected void compareResultLists(List<String>... refLists)
                           throws Exception
Compares the columns of a result set against several String-valued reference lists, taking order into account.

Parameters:
refLists - vararg of List. The first list is compared to the first column, the second list to the second column and so on
Throws:
Exception