Skip to content

Commit

Permalink
fix: make system-settings test time-zone independent (#19409)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbee authored Dec 9, 2024
1 parent b685faf commit 340bdac
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.Date;
import java.util.List;
import java.util.Locale;
Expand All @@ -40,6 +42,7 @@
import org.hisp.dhis.analytics.AnalyticsCacheTtlMode;
import org.hisp.dhis.common.cache.CacheStrategy;
import org.hisp.dhis.jsontree.JsonBoolean;
import org.hisp.dhis.jsontree.JsonDate;
import org.hisp.dhis.jsontree.JsonInteger;
import org.hisp.dhis.jsontree.JsonMap;
import org.hisp.dhis.jsontree.JsonMixed;
Expand Down Expand Up @@ -113,8 +116,9 @@ void testToJson() {
assertFalse(booleanValue.as(JsonBoolean.class).booleanValue());
JsonString dateValue = asJson.get("keyLastMetaDataSyncSuccess");
assertTrue(dateValue.isString());
assertEquals("1970-01-01T", dateValue.string().substring(0, 11));
assertEquals(":00:00.000", dateValue.string().substring(13));
assertEquals(
LocalDateTime.ofInstant(Instant.ofEpochMilli(0L), ZoneId.systemDefault()),
dateValue.as(JsonDate.class).date());
JsonString enumValue = asJson.get("keyCacheStrategy");
assertTrue(enumValue.isString());
assertEquals(CacheStrategy.CACHE_1_MINUTE, enumValue.parsed(CacheStrategy::valueOf));
Expand Down

0 comments on commit 340bdac

Please sign in to comment.