Skip to main content
Participating Frequently
November 26, 2008
Question

assertEquals(Date, Date) always fails

  • November 26, 2008
  • 1 reply
  • 1683 views
Just want to make sure this isn't just my code.<br /><br />Using FlexUnit 0.9, on Flex 3.<br /><br />I have the following assertion in my TestCase:<br />assertEquals("Date values should match", date, currentBasic.date);<br /><br />Which returns the error:<br />Date values should match - expected:<Wed Dec 1 00:00:00 GMT+1000 1920> but was:<Wed Dec 1 00:00:00 GMT+1000 1920><br /><br />Which as you can see, is the same value.<br /><br />I have to change this to:<br />assertEquals("Date values should match", date.toString(), currentBasic.date.toString());<br /><br />for the assertion to pass.<br /><br />Is this expected behaviour or a bug in FlexUnit?
This topic has been closed for replies.

1 reply

Participating Frequently
November 26, 2008
Looking through the source code FlexUnit doesn't have special handling<br />for Date's and Date's don't compare with == so I'd say it's a bug. Log<br />the issue at: https://bugs.adobe.com/jira/browse/FXU<br /><br />-- Daniel R. <danielr@neophi.com> [http://danielr.neophi.com/]<br /><br />On Wed, Nov 26, 2008 at 5:47 AM, Mark S Mandel <member@adobeforums.com> wrote:<br />> A new discussion was started by Mark S Mandel in<br />><br />> FlexUnit Development --<br />> assertEquals(Date, Date) always fails<br />><br />> Just want to make sure this isn't just my code.<br />><br />> Using FlexUnit 0.9, on Flex 3.<br />><br />> I have the following assertion in my TestCase:<br />> assertEquals("Date values should match", date, currentBasic.date);<br />><br />> Which returns the error:<br />> Date values should match - expected:<Wed Dec 1 00:00:00 GMT+1000 1920> but<br />> was:<Wed Dec 1 00:00:00 GMT+1000 1920><br />><br />> Which as you can see, is the same value.