Skip to content

Commit

Permalink
Fix TestTime, TestDateTimeFunctions to always test non-legacy timestamp
Browse files Browse the repository at this point in the history
When base class was calling `testSessionBuilder()`, it was using default
value of `legacy_timestamp` session toggle, which was not appropriate
for subclasses testing non-legacy semantics.
  • Loading branch information
findepi committed Jul 18, 2018
1 parent 235b0d5 commit a733cd2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Expand Up @@ -116,7 +116,7 @@ protected TestDateTimeFunctionsBase(boolean legacyTimestamp)
super(testSessionBuilder()
.setSystemProperty("legacy_timestamp", String.valueOf(legacyTimestamp))
.setTimeZoneKey(TIME_ZONE_KEY)
.setStartTime(new DateTime(2017, 04, 01, 12, 34, 56, 789, UTC_TIME_ZONE).getMillis())
.setStartTime(new DateTime(2017, 4, 1, 12, 34, 56, 789, UTC_TIME_ZONE).getMillis())
.build());
TIMESTAMP = legacyTimestamp ? LEGACY_TIMESTAMP : NEW_TIMESTAMP;
}
Expand Down Expand Up @@ -838,7 +838,7 @@ public void testDateParse()
public void testLocale()
{
Locale locale = Locale.KOREAN;
Session localeSession = testSessionBuilder()
Session localeSession = Session.builder(this.session)
.setTimeZoneKey(TIME_ZONE_KEY)
.setLocale(locale)
.build();
Expand Down Expand Up @@ -918,15 +918,15 @@ public void testTimeWithTimeZoneAtTimeZone()
// but our test framework doesn't support that syntax directly.

Session oldKathmanduTimeZoneOffsetSession =
testSessionBuilder()
Session.builder(this.session)
.setTimeZoneKey(TIME_ZONE_KEY)
.setStartTime(new DateTime(1980, 1, 1, 10, 0, 0, DATE_TIME_ZONE).getMillis())
.build();

TimeZoneKey europeWarsawTimeZoneKey = getTimeZoneKey("Europe/Warsaw");
DateTimeZone europeWarsawTimeZone = getDateTimeZone(europeWarsawTimeZoneKey);
Session europeWarsawSessionWinter =
testSessionBuilder()
Session.builder(this.session)
.setTimeZoneKey(europeWarsawTimeZoneKey)
.setStartTime(new DateTime(2017, 1, 1, 10, 0, 0, europeWarsawTimeZone).getMillis())
.build();
Expand Down
Expand Up @@ -145,7 +145,7 @@ public void testCastToTimeWithTimeZoneWithTZWithRulesChanged()
{
TimeZoneKey timeZoneThatChangedSince1970 = getTimeZoneKey("Asia/Kathmandu");
DateTimeZone dateTimeZoneThatChangedSince1970 = getDateTimeZone(timeZoneThatChangedSince1970);
Session session = testSessionBuilder()
Session session = Session.builder(this.session)
.setTimeZoneKey(timeZoneThatChangedSince1970)
.build();
try (FunctionAssertions localAssertions = new FunctionAssertions(session)) {
Expand All @@ -161,7 +161,7 @@ public void testCastToTimeWithTimeZoneDSTIsNotAppliedWhenTimeCrossesDST()
{
// Australia/Sydney will switch DST a second after session start
// For simplicity we have to use time zone that is going forward when entering DST zone with 1970-01-01
Session session = testSessionBuilder()
Session session = Session.builder(this.session)
.setTimeZoneKey(getTimeZoneKey("Australia/Sydney"))
.setStartTime(new DateTime(2017, 10, 1, 1, 59, 59, 999, getDateTimeZone(getTimeZoneKey("Australia/Sydney"))).getMillis())
.build();
Expand Down

0 comments on commit a733cd2

Please sign in to comment.