Skip to content

Commit

Permalink
Improve current_date function testing
Browse files Browse the repository at this point in the history
The test was only using TZ with positive shift, this change
allows to test if the code works properly for negative shift as well.
  • Loading branch information
fiedukow committed Feb 16, 2017
1 parent 905a3c4 commit 8836116
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.joda.time.DateTimeZone;
import org.joda.time.LocalTime;
import org.joda.time.ReadableInstant;
import org.joda.time.chrono.ISOChronology;
import org.testng.annotations.Test;

import java.time.Instant;
Expand Down Expand Up @@ -119,8 +120,13 @@ public void testCurrentDateTimezone()
throws Exception
{
TimeZoneKey kievTimeZoneKey = getTimeZoneKey("Europe/Kiev");
for (long instant = new DateTime(2000, 6, 15, 0, 0).getMillis(); instant < new DateTime(2016, 6, 15, 0, 0).getMillis(); instant += TimeUnit.HOURS.toMillis(1)) {
TimeZoneKey montrealTimeZoneKey = getTimeZoneKey("America/Montreal");
// We expect UTC millis later on so we have to use UTC chronology
for (long instant = ISOChronology.getInstanceUTC().getDateTimeMillis(2000, 6, 15, 0, 0, 0, 0);
instant < ISOChronology.getInstanceUTC().getDateTimeMillis(2016, 6, 15, 0, 0, 0, 0);
instant += TimeUnit.HOURS.toMillis(1)) {
assertCurrentDateAtInstant(kievTimeZoneKey, instant);
assertCurrentDateAtInstant(montrealTimeZoneKey, instant);
assertCurrentDateAtInstant(TIME_ZONE_KEY, instant);
}
}
Expand Down

0 comments on commit 8836116

Please sign in to comment.