org.apache.torque.criteria
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.criteria.CriteriaTest
All Implemented Interfaces:
junit.framework.Test

public class CriteriaTest
extends BaseTestCase

Test class for Criteria.

Version:
$Id: CriteriaTest.java 1448414 2013-02-20 21:06:35Z tfischer $
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 testAndCurrentDate()
           
 void testAndCurrentTime()
           
 void testAndDate()
          Testcase for andDate().
 void testAndString()
          Test where condition with several ANDs compairing against Strings.
 void testBetweenCriterion()
          Tests <= and =>.
 void testBooleanMysql()
          Test that true is evaluated correctly in Mysql.
 void testBooleanPostgresql()
          Test that true is evaluated correctly in Postgresql.
 void testClone()
          Test that cloning works.
 void testCriteriaCriterionGetsCopiedOr()
          Tests that a criterion is copied when being added as top level criterion using where (also tests and).
 void testCriteriaCriterionGetsCopiedWhere()
          Tests that a criterion is copied when being added as top level criterion using where (also tests and).
 void testCriteriaOffsetLimit()
           
 void testCriteriaTopLevelCriterionGetsCopiedOr()
          Tests that a criterion is copied when being added as top level criterion using where (also tests and).
 void testCriteriaTopLevelCriterionGetsCopiedWhere()
          Tests that a criterion is copied when being added as top level criterion using where (also tests and).
 void testCriteriaToStringLimit()
           
 void testCriteriaWithOffsetNoLimitMysql()
          TORQUE-87
 void testCriteriaWithOffsetNoLimitPostgresql()
           
 void testCriterionDoesNotGetChangedByCriteriaAnd()
          Tests that a criterion does not get changed if it is added as root criterion to a criteria which is afterwards changed.
 void testCriterionDoesNotGetChangedByCriteriaOr()
          Tests that a criterion does not get changed if it is added as root criterion to a criteria which is afterwards changed.
 void testCriterionIgnoreCase()
          Test Criterion.setIgnoreCase().
 void testDateWhere()
          testcase for where(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 testNestedCriterionComparisonEqual()
          Test that nesting Criterions works for equals comparison.
 void testNestedCriterionComparisonLessGreaterThan()
          Test that nesting Criterions works for other comparisons than equal.
 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 testOrUnaryOperator()
          Tests that unary operators as rValue are interpreted as comparison operator in the two-arg or method.
 void testSerialization()
          Test that serialization works.
 void testWhereDate()
          Testcase for whereDate()
 void testWhereNotEqual()
          Test basic where condition on a string with a non-equal.
 void testWhereString()
          Test basic where condition on a string.
 void testWhereStringReversed()
          Test basic where condition on a string.
 void testWhereUnaryOperator()
          Tests that unary operators as rValue are interpreted as comparison operator in the two-arg where method.
 
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.

testWhereString

public void testWhereString()
Test basic where condition on a string.


testWhereStringReversed

public void testWhereStringReversed()
Test basic where condition on a string. The condition is reversed, i.e the String preceeds the column.


testWhereNotEqual

public void testWhereNotEqual()
Test basic where condition on a string with a non-equal. comparison operator.


testWhereUnaryOperator

public void testWhereUnaryOperator()
Tests that unary operators as rValue are interpreted as comparison operator in the two-arg where method.


testOrUnaryOperator

public void testOrUnaryOperator()
Tests that unary operators as rValue are interpreted as comparison operator in the two-arg or method.


testAndString

public void testAndString()
Test where condition with several ANDs compairing against Strings.


testCriteriaTopLevelCriterionGetsCopiedWhere

public void testCriteriaTopLevelCriterionGetsCopiedWhere()
Tests that a criterion is copied when being added as top level criterion using where (also tests and). checks TORQUE-243.


testCriteriaTopLevelCriterionGetsCopiedOr

public void testCriteriaTopLevelCriterionGetsCopiedOr()
Tests that a criterion is copied when being added as top level criterion using where (also tests and). checks TORQUE-243.


testCriteriaCriterionGetsCopiedWhere

public void testCriteriaCriterionGetsCopiedWhere()
Tests that a criterion is copied when being added as top level criterion using where (also tests and). checks TORQUE-243.


testCriteriaCriterionGetsCopiedOr

public void testCriteriaCriterionGetsCopiedOr()
Tests that a criterion is copied when being added as top level criterion using where (also tests and). checks TORQUE-243.


testCriterionDoesNotGetChangedByCriteriaOr

public void testCriterionDoesNotGetChangedByCriteriaOr()
Tests that a criterion does not get changed if it is added as root criterion to a criteria which is afterwards changed. checks TORQUE-243.


testCriterionDoesNotGetChangedByCriteriaAnd

public void testCriterionDoesNotGetChangedByCriteriaAnd()
Tests that a criterion does not get changed if it is added as root criterion to a criteria which is afterwards changed. checks TORQUE-243.


testNestedCriterionComparisonEqual

public void testNestedCriterionComparisonEqual()
                                        throws org.apache.torque.TorqueException
Test that nesting Criterions works for equals comparison.

Throws:
org.apache.torque.TorqueException

testNestedCriterionComparisonLessGreaterThan

public void testNestedCriterionComparisonLessGreaterThan()
                                                  throws org.apache.torque.TorqueException
Test that nesting Criterions works for other comparisons than equal.

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

testBooleanMysql

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

Throws:
org.apache.torque.TorqueException

testBooleanPostgresql

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

Throws:
org.apache.torque.TorqueException

testWhereDate

public void testWhereDate()
                   throws org.apache.torque.TorqueException
Testcase for whereDate()

Throws:
org.apache.torque.TorqueException

testAndDate

public void testAndDate()
                 throws org.apache.torque.TorqueException
Testcase for andDate().

Throws:
org.apache.torque.TorqueException

testDateWhere

public void testDateWhere()
                   throws org.apache.torque.TorqueException
testcase for where(Date)

Throws:
org.apache.torque.TorqueException

testAndCurrentDate

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

testAndCurrentTime

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


testClone

public void testClone()
Test that cloning 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.