org.apache.torque.util
Class CriteriaTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.apache.torque.BaseTestCase
              extended by org.apache.torque.util.CriteriaTest
All Implemented Interfaces:
junit.framework.Test

public class CriteriaTest
extends BaseTestCase

Test class for Criteria.

Version:
$Id: CriteriaTest.java 1377464 2012-08-26 17:24:59Z tv $
Author:
Christopher Elkins, Sam Joseph, Scott Eade

Field Summary
 
Fields inherited from class org.apache.torque.BaseTestCase
CONFIG_FILE, database, databaseMap, databaseMysql, databaseOracle, databasePostgresql, integerColumnMap, stringColumnMap, tableMap
 
Constructor Summary
CriteriaTest()
           
 
Method Summary
 void setUp()
          Initializes the criteria.
 void testAddDate()
          testcase for addDate()
 void testAddString()
          Test basic adding of strings.
 void testAndDate()
          testcase for andDate() issue TORQUE-42
 void testBetweenCriterion()
          Tests <= and =>.
 void testBoolean()
          Test that true is evaluated correctly.
 void testCriteriaOffsetLimit()
           
 void testCriteriaToStringLimit()
           
 void testCriteriaWithOffsetNoLimitMysql()
          TORQUE-87
 void testCriteriaWithOffsetNoLimitPostgresql()
           
 void testCriterionIgnoreCase()
          Test Criterion.setIgnoreCase().
 void testCurrentDate()
           
 void testCurrentTime()
           
 void testDateAdd()
          testcase for add(Date)
 void testEquals()
          Test that Criteria.equals(Object) works correctly for a simple Criteria object.
 void testLikeWithoutWildcards()
          This test case verifies if the Criteria.LIKE comparison type will get replaced through Criteria.EQUAL if there are no SQL wildcards in the given value.
 void testNestedCriterion()
          test various properties of Criterion and nested criterion
 void testNotLikeWithoutWildcards()
          This test case verifies if the Criteria.NOT_LIKE comparison type will get replaced through Criteria.NOT_EQUAL if there are no SQL wildcards in the given value.
 void testOrderBy()
          Checks whether orderBy works.
 void testSerialization()
          Test that serialization works.
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, tearDown, 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CriteriaTest

public CriteriaTest()
Method Detail

setUp

public void setUp()
           throws Exception
Initializes the criteria.

Overrides:
setUp in class BaseTestCase
Throws:
Exception - if initialisation fails.

testAddString

public void testAddString()
Test basic adding of strings.


testNestedCriterion

public void testNestedCriterion()
                         throws org.apache.torque.TorqueException
test various properties of Criterion and nested criterion

Throws:
org.apache.torque.TorqueException

testBetweenCriterion

public void testBetweenCriterion()
                          throws org.apache.torque.TorqueException
Tests <= and =>.

Throws:
org.apache.torque.TorqueException

testCriterionIgnoreCase

public void testCriterionIgnoreCase()
                             throws org.apache.torque.TorqueException
Test Criterion.setIgnoreCase().

Throws:
org.apache.torque.TorqueException

testBoolean

public void testBoolean()
                 throws org.apache.torque.TorqueException
Test that true is evaluated correctly.

Throws:
org.apache.torque.TorqueException

testAddDate

public void testAddDate()
                 throws org.apache.torque.TorqueException
testcase for addDate()

Throws:
org.apache.torque.TorqueException

testAndDate

public void testAndDate()
                 throws org.apache.torque.TorqueException
testcase for andDate() issue TORQUE-42

Throws:
org.apache.torque.TorqueException

testDateAdd

public void testDateAdd()
                 throws org.apache.torque.TorqueException
testcase for add(Date)

Throws:
org.apache.torque.TorqueException

testCurrentDate

public void testCurrentDate()
                     throws org.apache.torque.TorqueException
Throws:
org.apache.torque.TorqueException

testCurrentTime

public void testCurrentTime()
                     throws org.apache.torque.TorqueException
Throws:
org.apache.torque.TorqueException

testCriteriaOffsetLimit

public void testCriteriaOffsetLimit()
                             throws org.apache.torque.TorqueException
Throws:
org.apache.torque.TorqueException

testCriteriaWithOffsetNoLimitPostgresql

public void testCriteriaWithOffsetNoLimitPostgresql()
                                             throws org.apache.torque.TorqueException
Throws:
org.apache.torque.TorqueException

testCriteriaWithOffsetNoLimitMysql

public void testCriteriaWithOffsetNoLimitMysql()
                                        throws org.apache.torque.TorqueException
TORQUE-87

Throws:
org.apache.torque.TorqueException

testCriteriaToStringLimit

public void testCriteriaToStringLimit()
                               throws org.apache.torque.TorqueException
Throws:
org.apache.torque.TorqueException

testLikeWithoutWildcards

public void testLikeWithoutWildcards()
                              throws org.apache.torque.TorqueException
This test case verifies if the Criteria.LIKE comparison type will get replaced through Criteria.EQUAL if there are no SQL wildcards in the given value.

Throws:
org.apache.torque.TorqueException

testNotLikeWithoutWildcards

public void testNotLikeWithoutWildcards()
This test case verifies if the Criteria.NOT_LIKE comparison type will get replaced through Criteria.NOT_EQUAL if there are no SQL wildcards in the given value.


testSerialization

public void testSerialization()
Test that serialization works.


testEquals

public void testEquals()
                throws org.apache.torque.TorqueException
Test that Criteria.equals(Object) works correctly for a simple Criteria object.

Throws:
org.apache.torque.TorqueException

testOrderBy

public void testOrderBy()
                 throws org.apache.torque.TorqueException
Checks whether orderBy works.

Throws:
org.apache.torque.TorqueException


Copyright © 2000-2013 The Apache Software Foundation. All Rights Reserved.