db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mpoes...@apache.org
Subject cvs commit: db-torque/src/test/org/apache/torque/util CriteriaTest.java
Date Fri, 18 Jul 2003 20:11:48 GMT
mpoeschl    2003/07/18 13:11:48

  Modified:    src/test/org/apache/torque/util CriteriaTest.java
  Log:
  add testcase for add(Date)
  
  Revision  Changes    Path
  1.20      +32 -1     db-torque/src/test/org/apache/torque/util/CriteriaTest.java
  
  Index: CriteriaTest.java
  ===================================================================
  RCS file: /home/cvs/db-torque/src/test/org/apache/torque/util/CriteriaTest.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- CriteriaTest.java	19 Jun 2003 04:05:54 -0000	1.19
  +++ CriteriaTest.java	18 Jul 2003 20:11:48 -0000	1.20
  @@ -54,6 +54,8 @@
    * <http://www.apache.org/>.
    */
   
  +import java.util.Calendar;
  +import java.util.Date;
   import java.util.List;
   
   import org.apache.commons.configuration.BaseConfiguration;
  @@ -314,10 +316,39 @@
           assertEquals("TABLE.COLUMN=1", cc.toString());
       }
   
  +    /**
  +     * testcase for addDate()
  +     */
       public void testAddDate()
       {
           Criteria c = new Criteria();
           c.addDate("TABLE.DATE_COLUMN", 2003, 0, 22);
  +
  +        String expect = "SELECT  FROM TABLE WHERE TABLE.DATE_COLUMN='20030122000000'";
  +
  +        String result = null;
  +        try
  +        {
  +            result = BasePeer.createQueryString(c);
  +        }
  +        catch (TorqueException e)
  +        {
  +            e.printStackTrace();
  +            fail("TorqueException thrown in BasePeer.createQueryString()");
  +        }
  +        assertEquals(expect, result);
  +    }
  +
  +    /**
  +     * testcase for add(Date)
  +     */
  +    public void testDateAdd()
  +    {
  +        Calendar cal = Calendar.getInstance();
  +        cal.set(2003, 0, 22, 0, 0, 0);
  +        Date date = cal.getTime();
  +        Criteria c = new Criteria();
  +        c.add("TABLE.DATE_COLUMN", date);
   
           String expect = "SELECT  FROM TABLE WHERE TABLE.DATE_COLUMN='20030122000000'";
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


Mime
View raw message