Last active
August 29, 2015 14:24
-
-
Save irof/c320391d605ba2ed853c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.time.LocalDateTime; | |
import java.util.Date; | |
import static org.junit.Assert.assertFalse; | |
/** | |
* @author irof | |
*/ | |
public class DateAndDateTimeTest { | |
@org.junit.Test | |
public void testCompareDate() throws Exception { | |
Date date1 = new Date(); | |
Date date2 = new Date(); | |
assertFalse(date1.before(date2)); | |
assertFalse(date2.before(date1)); | |
assertFalse(date1.after(date2)); | |
assertFalse(date2.after(date1)); | |
} | |
@org.junit.Test | |
public void testCompareLocalDateTime() throws Exception { | |
LocalDateTime localDate1 = LocalDateTime.of(2015, 7, 11, 12, 34); | |
LocalDateTime localDate2 = LocalDateTime.of(2015, 7, 11, 12, 34); | |
assertFalse(localDate1.isBefore(localDate2)); | |
assertFalse(localDate2.isBefore(localDate1)); | |
assertFalse(localDate1.isAfter(localDate2)); | |
assertFalse(localDate2.isAfter(localDate1)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment