Package org.apache.torque.criteria
Class CriteriaTest
- java.lang.Object
-
- org.apache.torque.BaseTestCase
-
- org.apache.torque.criteria.CriteriaTest
-
public class CriteriaTest extends BaseTestCase
Test class for Criteria.- Version:
- $Id: CriteriaTest.java 1867515 2019-09-25 15:02:03Z 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 Constructor Description CriteriaTest()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidsetUp()Initializes the criteria.voidtestAndCurrentDate()voidtestAndCurrentTime()voidtestAndDate()Testcase for andDate().voidtestAndString()Test where condition with several ANDs compairing against Strings.voidtestBetweenCriterion()Tests <= and =>.voidtestBooleanMysql()Test that true is evaluated correctly in Mysql.voidtestBooleanPostgresql()Test that true is evaluated correctly in Postgresql.voidtestClone()Test that cloning works.voidtestCriteriaCriterionGetsCopiedOr()Tests that a criterion is copied when being added as top level criterion using where (also tests and).voidtestCriteriaCriterionGetsCopiedWhere()Tests that a criterion is copied when being added as top level criterion using where (also tests and).voidtestCriteriaOffsetLimit()voidtestCriteriaTopLevelCriterionGetsCopiedOr()Tests that a criterion is copied when being added as top level criterion using where (also tests and).voidtestCriteriaTopLevelCriterionGetsCopiedWhere()Tests that a criterion is copied when being added as top level criterion using where (also tests and).voidtestCriteriaToStringLimit()voidtestCriteriaWithOffsetNoLimitMysql()TORQUE-87voidtestCriteriaWithOffsetNoLimitPostgresql()voidtestCriterionDoesNotGetChangedByCriteriaAnd()Tests that a criterion does not get changed if it is added as root criterion to a criteria which is afterwards changed.voidtestCriterionDoesNotGetChangedByCriteriaOr()Tests that a criterion does not get changed if it is added as root criterion to a criteria which is afterwards changed.voidtestCriterionIgnoreCase()Test Criterion.setIgnoreCase().voidtestDateWhere()testcase for where(Date)voidtestEquals()Test thatCriteria.equals(Object)works correctly for a simple Criteria object.voidtestLikeWithoutWildcards()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.voidtestNestedCriterionComparisonEqual()Test that nesting Criterions works for equals comparison.voidtestNestedCriterionComparisonLessGreaterThan()Test that nesting Criterions works for other comparisons than equal.voidtestNotLikeWithoutWildcards()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.voidtestOrderBy()Checks whether orderBy works.voidtestOrUnaryOperator()Tests that unary operators as rValue are interpreted as comparison operator in the two-arg or method.voidtestSerialization()Test that serialization works.voidtestWhereDate()Testcase for whereDate()voidtestWhereNotEqual()Test basic where condition on a string with a non-equal.voidtestWhereString()Test basic where condition on a string.voidtestWhereStringReversed()Test basic where condition on a string.voidtestWhereUnaryOperator()Tests that unary operators as rValue are interpreted as comparison operator in the two-arg where method.
-
-
-
Method Detail
-
setUp
@BeforeEach public void setUp() throws ExceptionInitializes 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.
-
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 public void testNestedCriterionComparisonEqual() throws TorqueExceptionTest that nesting Criterions works for equals comparison.- Throws:
TorqueException
-
testNestedCriterionComparisonLessGreaterThan
@Test public void testNestedCriterionComparisonLessGreaterThan() throws TorqueExceptionTest that nesting Criterions works for other comparisons than equal.- Throws:
TorqueException- if fails
-
testBetweenCriterion
@Test public void testBetweenCriterion() throws TorqueExceptionTests <= and =>.- Throws:
TorqueException- if fail
-
testCriterionIgnoreCase
@Test public void testCriterionIgnoreCase() throws TorqueExceptionTest Criterion.setIgnoreCase().- Throws:
TorqueException
-
testBooleanMysql
@Test public void testBooleanMysql() throws TorqueExceptionTest that true is evaluated correctly in Mysql.- Throws:
TorqueException
-
testBooleanPostgresql
@Test public void testBooleanPostgresql() throws TorqueExceptionTest that true is evaluated correctly in Postgresql.- Throws:
TorqueException
-
testWhereDate
@Test public void testWhereDate() throws TorqueExceptionTestcase for whereDate()- Throws:
TorqueException
-
testAndDate
@Test public void testAndDate() throws TorqueExceptionTestcase for andDate().- Throws:
TorqueException
-
testDateWhere
@Test public void testDateWhere() throws TorqueExceptiontestcase for where(Date)- Throws:
TorqueException
-
testAndCurrentDate
@Test public void testAndCurrentDate() throws TorqueException- Throws:
TorqueException
-
testAndCurrentTime
@Test public void testAndCurrentTime() throws TorqueException- Throws:
TorqueException
-
testCriteriaOffsetLimit
@Test public void testCriteriaOffsetLimit() throws TorqueException- Throws:
TorqueException
-
testCriteriaWithOffsetNoLimitPostgresql
@Test public void testCriteriaWithOffsetNoLimitPostgresql() throws TorqueException- Throws:
TorqueException
-
testCriteriaWithOffsetNoLimitMysql
@Test public void testCriteriaWithOffsetNoLimitMysql() throws TorqueExceptionTORQUE-87- Throws:
TorqueException
-
testCriteriaToStringLimit
@Test public void testCriteriaToStringLimit() throws TorqueException- Throws:
TorqueException
-
testLikeWithoutWildcards
@Test public void testLikeWithoutWildcards() throws TorqueExceptionThis 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 public void testEquals() throws TorqueExceptionTest thatCriteria.equals(Object)works correctly for a simple Criteria object.- Throws:
TorqueException
-
testOrderBy
@Test public void testOrderBy() throws TorqueExceptionChecks whether orderBy works.- Throws:
TorqueException
-
-