You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by he...@apache.org on 2005/08/25 11:40:28 UTC
svn commit: r240027 -
/jakarta/commons/proper/email/trunk/src/test/org/apache/commons/mail/EmailTest.java
Author: henning
Date: Thu Aug 25 02:40:24 2005
New Revision: 240027
URL: http://svn.apache.org/viewcvs?rev=240027&view=rev
Log:
Gee, do you all have multi-GHz CPUs? This test fails consistently for
me on a slow CPU... Add some fuzzyness to the time compare.
Modified:
jakarta/commons/proper/email/trunk/src/test/org/apache/commons/mail/EmailTest.java
Modified: jakarta/commons/proper/email/trunk/src/test/org/apache/commons/mail/EmailTest.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/email/trunk/src/test/org/apache/commons/mail/EmailTest.java?rev=240027&r1=240026&r2=240027&view=diff
==============================================================================
--- jakarta/commons/proper/email/trunk/src/test/org/apache/commons/mail/EmailTest.java (original)
+++ jakarta/commons/proper/email/trunk/src/test/org/apache/commons/mail/EmailTest.java Thu Aug 25 02:40:24 2005
@@ -1559,13 +1559,21 @@
public void testGetSetSentDate()
{
// with input date
+
Date dtTest = Calendar.getInstance().getTime();
this.email.setSentDate(dtTest);
assertEquals(dtTest, this.email.getSentDate());
// with null input (this is a fudge :D)
this.email.setSentDate(null);
- assertEquals(dtTest, this.email.getSentDate());
+
+ Date sentDate = this.email.getSentDate();
+
+ // Date objects are millisecond specific. If you have a slow processor,
+ // time passes between the generation of dtTest and the new Date() in
+ // getSentDate() and this test fails. Make sure that the difference
+ // is less than a second...
+ assertTrue(Math.abs(sentDate.getTime() - dtTest.getTime()) < 1000);
}
/** */
@@ -1625,4 +1633,4 @@
assertEquals(strPassword, this.email.getPopPassword());
}
-}
\ No newline at end of file
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org