Package org.apache.torque.criteria
Class CriteriaTest
java.lang.Object
org.apache.torque.BaseTestCase
org.apache.torque.criteria.CriteriaTest
Test class for Criteria.
- Version:
- $Id: CriteriaTest.java 1917567 2024-05-08 09:16:31Z gk $
- 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, stringColumnMap2, stringColumnMap3, tableMap -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidsetUp()Initializes the criteria.voidvoidvoidTestcase for andDate().voidTest where condition with several ANDs compairing against Strings.voidTests <= and =>.voidTest that true is evaluated correctly in Mysql.voidTest that true is evaluated correctly in Postgresql.voidTest that cloning works.voidTests that a criterion is copied when being added as top level criterion using where (also tests and).voidTests that a criterion is copied when being added as top level criterion using where (also tests and).voidvoidTests that a criterion is copied when being added as top level criterion using where (also tests and).voidTests that a criterion is copied when being added as top level criterion using where (also tests and).voidvoidTORQUE-87voidvoidTests that a criterion does not get changed if it is added as root criterion to a criteria which is afterwards changed.voidTests that a criterion does not get changed if it is added as root criterion to a criteria which is afterwards changed.voidTest Criterion.setIgnoreCase().voidtestcase for where(Date)voidvoidTest thatCriteria.equals(Object)works correctly for a simple Criteria object.voidvoidThis 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.voidTest that nesting Criterions works for equals comparison.voidTest that nesting Criterions works for other comparisons than equal.voidThis 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.voidChecks whether orderBy works.voidTests that unary operators as rValue are interpreted as comparison operator in the two-arg or method.voidTest that serialization works.voidTestcase for whereDate()voidTest basic where condition on a string with a non-equal.voidTest basic where condition on a string.voidTest basic where condition on a string.voidTests that unary operators as rValue are interpreted as comparison operator in the two-arg where method.
-
Constructor Details
-
CriteriaTest
public CriteriaTest()
-
-
Method Details
-
setUp
Initializes the criteria.- Overrides:
setUpin classBaseTestCase- Throws:
Exception- if initialization fails.
-
testWhereString
@Test public void testWhereString()Test basic where condition on a string. -
testWhereStringReversed
@Test public void testWhereStringReversed()Test basic where condition on a string. The condition is reversed, i.e the String preceeds the column. -
testWhereNotEqual
@Test public void testWhereNotEqual()Test basic where condition on a string with a non-equal. comparison operator. -
testWhereUnaryOperator
@Test public void testWhereUnaryOperator()Tests that unary operators as rValue are interpreted as comparison operator in the two-arg where method. -
testIsNullOperator
@Test public void testIsNullOperator() -
testOrUnaryOperator
@Test public void testOrUnaryOperator()Tests that unary operators as rValue are interpreted as comparison operator in the two-arg or method. -
testAndString
@Test public void testAndString()Test where condition with several ANDs compairing against Strings. -
testCriteriaTopLevelCriterionGetsCopiedWhere
@Test 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
@Test 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
@Test 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
@Test 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
@Test 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
@Test 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
Test that nesting Criterions works for equals comparison.- Throws:
TorqueException
-
testNestedCriterionComparisonLessGreaterThan
Test that nesting Criterions works for other comparisons than equal.- Throws:
TorqueException- if fails
-
testBetweenCriterion
Tests <= and =>.- Throws:
TorqueException- if fail
-
testCriterionIgnoreCase
Test Criterion.setIgnoreCase().- Throws:
TorqueException
-
testBooleanMysql
Test that true is evaluated correctly in Mysql.- Throws:
TorqueException
-
testBooleanPostgresql
Test that true is evaluated correctly in Postgresql.- Throws:
TorqueException
-
testWhereDate
Testcase for whereDate()- Throws:
TorqueException
-
testAndDate
Testcase for andDate().- Throws:
TorqueException
-
testDateWhere
testcase for where(Date)- Throws:
TorqueException
-
testAndCurrentDate
- Throws:
TorqueException
-
testDistinctCount
- Throws:
TorqueException
-
testAndCurrentTime
- Throws:
TorqueException
-
testCriteriaOffsetLimit
- Throws:
TorqueException
-
testCriteriaWithOffsetNoLimitPostgresql
- Throws:
TorqueException
-
testCriteriaWithOffsetNoLimitMysql
TORQUE-87- Throws:
TorqueException
-
testCriteriaToStringLimit
- Throws:
TorqueException
-
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.- Throws:
TorqueException
-
testNotLikeWithoutWildcards
@Test 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
@Test public void testSerialization()Test that serialization works. -
testClone
@Test public void testClone()Test that cloning works. -
testEquals
Test thatCriteria.equals(Object)works correctly for a simple Criteria object.- Throws:
TorqueException
-
testOrderBy
Checks whether orderBy works.- Throws:
TorqueException
-