Author: tfischer
Date: Fri Sep 21 20:23:23 2012
New Revision: 1388664
URL: http://svn.apache.org/viewvc?rev=1388664&view=rev
Log:
Added Tests for selecting with operators isnull and isnotnull
Modified:
db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/peer/SelectTest.java
Modified:
db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/peer/SelectTest.java
URL:
http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/peer/SelectTest.java?rev=1388664&r1=1388663&r2=1388664&view=diff
==============================================================================
---
db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/peer/SelectTest.java
(original)
+++
db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/peer/SelectTest.java
Fri Sep 21 20:23:23 2012
@@ -28,6 +28,8 @@ import org.apache.torque.Torque;
import org.apache.torque.criteria.Criteria;
import org.apache.torque.test.Author;
import org.apache.torque.test.AuthorPeer;
+import org.apache.torque.test.Book;
+import org.apache.torque.test.BookPeer;
/**
* Tests simple selects.
@@ -189,4 +191,62 @@ public class SelectTest extends BaseData
// expected
}
}
+
+ /**
+ * Tests a select with the operator IsNull using a null comparison.
+ *
+ * @throws Exception if the test fails.
+ */
+ public void testSelectOperatorIsNull() throws Exception
+ {
+ Criteria criteria = new Criteria();
+ criteria.where(BookPeer.ISBN, null, Criteria.ISNULL);
+
+ List<Book> books = BookPeer.doSelect(criteria);
+ assertEquals(10, books.size());
+ }
+
+ /**
+ * Tests a select with the operator IsNull using not null
+ * as comparison value.
+ *
+ * @throws Exception if the test fails.
+ */
+ public void testSelectOperatorIsNullOtherComparison() throws Exception
+ {
+ Criteria criteria = new Criteria();
+ criteria.where(BookPeer.ISBN, "xy", Criteria.ISNULL);
+
+ List<Book> books = BookPeer.doSelect(criteria);
+ assertEquals(10, books.size());
+ }
+
+ /**
+ * Tests a select with the operator IsNotNull
+ *
+ * @throws Exception if the test fails.
+ */
+ public void testSelectOperatorIsNotNull() throws Exception
+ {
+ Criteria criteria = new Criteria();
+ criteria.where(BookPeer.ISBN, null, Criteria.ISNOTNULL);
+
+ List<Book> books = BookPeer.doSelect(criteria);
+ assertEquals(90, books.size());
+ }
+
+ /**
+ * Tests a select with the operator IsNotNull using not null
+ * as comparison value.
+ *
+ * @throws Exception if the test fails.
+ */
+ public void testSelectOperatorIsNotNullOtherComparison() throws Exception
+ {
+ Criteria criteria = new Criteria();
+ criteria.where(BookPeer.ISBN, "xy", Criteria.ISNOTNULL);
+
+ List<Book> books = BookPeer.doSelect(criteria);
+ assertEquals(90, books.size());
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]