DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26922>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26922 [lang] public static boolean DateUtils.equals(Date dt1, Date dt2) ? ------- Additional Comments From [EMAIL PROTECTED] 2004-02-16 18:57 ------- The assumption that time values are equal for Date and Timestamp is incorrect as the basic test below shows. Writting unit tests first avoids this kind of misunderstandings ;-) Also, supplying unit tests with your code greatly increases the patching process and confidence in submissions compared to "blind" submissions. :-) Index: ObjectUtilsTest.java =================================================================== retrieving revision 1.9 diff -u -r1.9 ObjectUtilsTest.java --- ObjectUtilsTest.java 18 Aug 2003 02:22:25 -0000 1.9 +++ ObjectUtilsTest.java 16 Feb 2004 18:50:39 -0000 @@ -1,7 +1,6 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2002-2003 The Apache Software Foundation. All rights +/* + * + * Copyright (c) 2002-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -122,6 +121,15 @@ assertTrue("ObjectUtils.equals(\"foo\", \"foo\") returned false", ObjectUtils.equals(FOO, FOO)); } + public void testDateEquals() { + long now = 1076957313284L; // Feb 16, 2004 10:49 PST + java.util.Date date = new java.util.Date(now); + java.util.Date timestamp = new java.sql.Timestamp(now); + assertEquals(date.getTime(), timestamp.getTime()); + assertEquals(timestamp, date); + assertTrue(ObjectUtils.equals(date, timestamp)); + } + public void testIdentityToString() { assertEquals(null, ObjectUtils.identityToString(null)); assertEquals( --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
