This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
As Date implements the equals method, assertEquals(Object, Object) should work fine...
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Joined: Jul 04, 2004
I will try to work out this way..and get back to u...
The other thing to watch with dates is the precision. ALl of the methods post about (that check for equality) require the dates to be the same to the millisecond. If you want to check just the date part or the time part, you can write a custom assertion. For example,
I favor assertEquals(date1, date2); over assertTrue(date1.equals(date2)); because it gives clearer output on an assertion failure.