[hibernate-commits] Hibernate SVN: r15781 - core/trunk/annotations/src/test/java/org/hibernate/test/annotations.

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Wed Jan 14 09:15:30 EST 2009


Author: jcosta at redhat.com
Date: 2009-01-14 09:15:30 -0500 (Wed, 14 Jan 2009)
New Revision: 15781

Modified:
   core/trunk/annotations/src/test/java/org/hibernate/test/annotations/EntityTest.java
Log:
ANN-795 - Added DateFormat to compare dates, otherwise, there are problems with Sybase

Modified: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/EntityTest.java
===================================================================
--- core/trunk/annotations/src/test/java/org/hibernate/test/annotations/EntityTest.java	2009-01-14 14:10:36 UTC (rev 15780)
+++ core/trunk/annotations/src/test/java/org/hibernate/test/annotations/EntityTest.java	2009-01-14 14:15:30 UTC (rev 15781)
@@ -1,6 +1,8 @@
 //$Id$
 package org.hibernate.test.annotations;
 
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.GregorianCalendar;
 import java.util.List;
@@ -17,9 +19,11 @@
  * @author Emmanuel Bernard
  */
 public class EntityTest extends TestCase {
-
+	private DateFormat df;
+	
 	public EntityTest(String x) {
 		super( x );
+		df = SimpleDateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG);
 	}
 
 	public void testLoad() throws Exception {
@@ -337,10 +341,10 @@
 		Flight copyAirFrance = (Flight) q.uniqueResult();
 		assertNotNull( copyAirFrance );
 		assertEquals(
-				new Date( 05, 06, 21 ),
-				copyAirFrance.getDepartureDate()
+				df.format(new Date( 05, 06, 21 )).toString(),
+				df.format(copyAirFrance.getDepartureDate()).toString()
 		);
-		assertEquals( copyAirFrance.getBuyDate().getTime() / 1000 , airFrance.getBuyDate().getTime() / 1000 );
+		assertEquals( df.format(airFrance.getBuyDate()), df.format(copyAirFrance.getBuyDate()));
 
 		s.delete( copyAirFrance );
 		tx.commit();




More information about the hibernate-commits mailing list