Pārlūkot izejas kodu

draft: datetime

Ranides Atterwim 11 mēneši atpakaļ
vecāks
revīzija
9128927696

+ 31 - 13
assira.commons/src/main/java/net/ranides/assira/time/DateTimeZones.java

@@ -2,13 +2,17 @@ package net.ranides.assira.time;
 
 import lombok.experimental.UtilityClass;
 import net.ranides.assira.collection.maps.MapBuilder;
+import net.ranides.assira.collection.sets.ArraySet;
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.Contract;
+import org.jetbrains.annotations.TestOnly;
 
 import java.time.ZoneId;
 import java.time.ZoneOffset;
 import java.time.zone.ZoneRules;
+import java.time.zone.ZoneRulesException;
 import java.time.zone.ZoneRulesProvider;
 import java.util.Collections;
-import java.util.Map;
 import java.util.NavigableMap;
 import java.util.Set;
 import java.util.TreeMap;
@@ -24,39 +28,53 @@ public class DateTimeZones {
 
     public static final ZoneId WET = ZoneId.of("WET");
 
-    public static final ZoneId CET = ZoneId.of("Europe/Brussels");
-
     public static final ZoneId MET = ZoneId.of("MET");
 
+    public static final ZoneId CET = ZoneId.of("Europe/Brussels");
+
     public static final ZoneId PL = ZoneId.of("Europe/Warsaw");
 
-    public static final ZoneId NONE;
+    @TestOnly
+    public static final ZoneId TV;
+
+    public static final ZoneId UNDEFINED;
 
     static {
-        final String id = "NONE";
-        final ZoneOffset offset = ZoneOffset.ofHours(0);
-        ZoneRules rules = ZoneRules.of(offset, offset, Collections.emptyList(), Collections.emptyList(), Collections.emptyList());
 
-        ZoneRulesProvider customProvider = new ZoneRulesProvider() {
+        String id_undefined = "Undefined";
+
+        String id_tuvalu = "Tuvalu";
+
+        TreeMap<String, ZoneRules> providedMap = MapBuilder.<String, ZoneRules>tree()
+            .append(id_undefined, ZoneRules.of(ZoneOffset.ofHours(0), ZoneOffset.ofHours(0), Collections.emptyList(), Collections.emptyList(), Collections.emptyList()))
+            .append(id_tuvalu, ZoneId.of("Pacific/Funafuti").getRules())
+            .map();
+
+        ZoneRulesProvider provider = new ZoneRulesProvider() {
             @Override
             protected Set<String> provideZoneIds() {
-                return Collections.singleton(id);
+                return providedMap.navigableKeySet();
             }
 
             @Override
             protected NavigableMap<String, ZoneRules> provideVersions(String zoneId) {
-                return MapBuilder.<String, ZoneRules>tree().append(id, rules).map();
+                return providedMap;
             }
 
             @Override
             protected ZoneRules provideRules(String zoneId, boolean forCaching) {
-                return rules;
+                return providedMap.computeIfAbsent(zoneId, (k) -> {
+                    throw new ZoneRulesException("Unknown time-zone ID: " + zoneId);
+                });
             }
         };
 
-        ZoneRulesProvider.registerProvider(customProvider);
+        ZoneRulesProvider.registerProvider(provider);
+
+        UNDEFINED = ZoneId.of(id_undefined);
+
+        TV = ZoneId.of(id_tuvalu);
 
-        NONE = ZoneId.of(id);
     }
 
 }

+ 70 - 83
assira.commons/src/test/java/net/ranides/assira/time/DateTimeParsersTest.java

@@ -8,6 +8,8 @@ import java.time.format.DateTimeParseException;
 
 import static net.ranides.assira.time.DateTimeFormat.DATE;
 import static net.ranides.assira.time.DateTimeFormat.DATETIME;
+import static net.ranides.assira.time.DateTimeFormat.TIME;
+import static net.ranides.assira.time.DateTimeZones.TV;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertThrows;
 
@@ -19,51 +21,45 @@ public class DateTimeParsersTest {
             DATETIME.parse("2020-08-24T08:45:00");
         });
 
-        assertEquals("2020-08-24T08:45+02:00[Poland]", DATETIME.parse("2020-08-24T08:45:00+02:00[Poland]").toString());
-        assertEquals("2020-08-24T08:45Z", DATETIME.parse("2020-08-24T08:45:00Z").toString());
-        assertEquals("2020-08-24T08:45+02:00[Europe/Warsaw]", DATETIME.parse("2020-08-24T08:45:00+06:00[Europe/Warsaw]").toString());
-        assertEquals("2020-08-24T08:45+02:00[Europe/Warsaw]", DATETIME.parse("2020-08-24T08:45:00+17:00[Europe/Warsaw]").toString());
-        assertEquals("2020-08-24T08:45+06:00", DATETIME.parse("2020-08-24T08:45:00+06:00").toString());
-        assertEquals("2020-08-24T08:45+17:00", DATETIME.parse("2020-08-24T08:45:00+17:00").toString());
+        assertEquals("2020-08-24T08:45+02:00[Poland]",          DATETIME.parse("2020-08-24T08:45:00+02:00[Poland]").toString());
+        assertEquals("2020-08-24T08:45Z",                       DATETIME.parse("2020-08-24T08:45:00Z").toString());
+        assertEquals("2020-08-24T08:45+02:00[Europe/Warsaw]",   DATETIME.parse("2020-08-24T08:45:00+06:00[Europe/Warsaw]").toString());
+        assertEquals("2020-08-24T08:45+02:00[Europe/Warsaw]",   DATETIME.parse("2020-08-24T08:45:00+17:00[Europe/Warsaw]").toString());
+        assertEquals("2020-08-24T08:45+06:00",                  DATETIME.parse("2020-08-24T08:45:00+06:00").toString());
+        assertEquals("2020-08-24T08:45+17:00",                  DATETIME.parse("2020-08-24T08:45:00+17:00").toString());
     }
 
     @Test
     public void testParseDateTimeSourced() {
-        ZoneId zone = ZoneId.of("Pacific/Funafuti");
-
-        assertEquals("2020-08-24T08:45+12:00[Pacific/Funafuti]", DATETIME.withSourceZone(zone).parse("2020-08-24T08:45:00").toString());
-        assertEquals("2020-08-24T08:45+02:00[Poland]", DATETIME.withSourceZone(zone).parse("2020-08-24T08:45:00+02:00[Poland]").toString());
-        assertEquals("2020-08-24T08:45Z", DATETIME.withSourceZone(zone).parse("2020-08-24T08:45:00Z").toString());
-        assertEquals("2020-08-24T08:45+02:00[Europe/Warsaw]", DATETIME.withSourceZone(zone).parse("2020-08-24T08:45:00+06:00[Europe/Warsaw]").toString());
-        assertEquals("2020-08-24T08:45+02:00[Europe/Warsaw]", DATETIME.withSourceZone(zone).parse("2020-08-24T08:45:00+17:00[Europe/Warsaw]").toString());
-        assertEquals("2020-08-24T08:45+06:00", DATETIME.withSourceZone(zone).parse("2020-08-24T08:45:00+06:00").toString());
-        assertEquals("2020-08-24T08:45+17:00", DATETIME.withSourceZone(zone).parse("2020-08-24T08:45:00+17:00").toString());
+        assertEquals("2020-08-24T08:45+12:00[Tuvalu]",          DATETIME.withSourceZone(TV).parse("2020-08-24T08:45:00").toString());
+        assertEquals("2020-08-24T08:45+02:00[Poland]",          DATETIME.withSourceZone(TV).parse("2020-08-24T08:45:00+02:00[Poland]").toString());
+        assertEquals("2020-08-24T08:45Z",                       DATETIME.withSourceZone(TV).parse("2020-08-24T08:45:00Z").toString());
+        assertEquals("2020-08-24T08:45+02:00[Europe/Warsaw]",   DATETIME.withSourceZone(TV).parse("2020-08-24T08:45:00+06:00[Europe/Warsaw]").toString());
+        assertEquals("2020-08-24T08:45+02:00[Europe/Warsaw]",   DATETIME.withSourceZone(TV).parse("2020-08-24T08:45:00+17:00[Europe/Warsaw]").toString());
+        assertEquals("2020-08-24T08:45+06:00",                  DATETIME.withSourceZone(TV).parse("2020-08-24T08:45:00+06:00").toString());
+        assertEquals("2020-08-24T08:45+17:00",                  DATETIME.withSourceZone(TV).parse("2020-08-24T08:45:00+17:00").toString());
     }
 
     @Test
     public void testParseDateTimeTargeted() {
-        ZoneId zone = ZoneId.of("Pacific/Funafuti");
-
-        assertEquals("2020-08-24T08:45+12:00[Pacific/Funafuti]", DATETIME.withTargetZone(zone).parse("2020-08-24T08:45:00").toString());
-        assertEquals("2020-08-24T18:45+12:00[Pacific/Funafuti]", DATETIME.withTargetZone(zone).parse("2020-08-24T08:45:00+02:00[Poland]").toString());
-        assertEquals("2020-08-24T20:45+12:00[Pacific/Funafuti]", DATETIME.withTargetZone(zone).parse("2020-08-24T08:45:00Z").toString());
-        assertEquals("2020-08-24T18:45+12:00[Pacific/Funafuti]", DATETIME.withTargetZone(zone).parse("2020-08-24T08:45:00+06:00[Europe/Warsaw]").toString());
-        assertEquals("2020-08-24T18:45+12:00[Pacific/Funafuti]", DATETIME.withTargetZone(zone).parse("2020-08-24T08:45:00+17:00[Europe/Warsaw]").toString());
-        assertEquals("2020-08-24T14:45+12:00[Pacific/Funafuti]", DATETIME.withTargetZone(zone).parse("2020-08-24T08:45:00+06:00").toString());
-        assertEquals("2020-08-24T03:45+12:00[Pacific/Funafuti]", DATETIME.withTargetZone(zone).parse("2020-08-24T08:45:00+17:00").toString());
+        assertEquals("2020-08-24T08:45+12:00[Tuvalu]", DATETIME.withTargetZone(TV).parse("2020-08-24T08:45:00").toString());
+        assertEquals("2020-08-24T18:45+12:00[Tuvalu]", DATETIME.withTargetZone(TV).parse("2020-08-24T08:45:00+02:00[Poland]").toString());
+        assertEquals("2020-08-24T20:45+12:00[Tuvalu]", DATETIME.withTargetZone(TV).parse("2020-08-24T08:45:00Z").toString());
+        assertEquals("2020-08-24T18:45+12:00[Tuvalu]", DATETIME.withTargetZone(TV).parse("2020-08-24T08:45:00+06:00[Europe/Warsaw]").toString());
+        assertEquals("2020-08-24T18:45+12:00[Tuvalu]", DATETIME.withTargetZone(TV).parse("2020-08-24T08:45:00+17:00[Europe/Warsaw]").toString());
+        assertEquals("2020-08-24T14:45+12:00[Tuvalu]", DATETIME.withTargetZone(TV).parse("2020-08-24T08:45:00+06:00").toString());
+        assertEquals("2020-08-24T03:45+12:00[Tuvalu]", DATETIME.withTargetZone(TV).parse("2020-08-24T08:45:00+17:00").toString());
     }
 
     @Test
     public void testParseDateTimeZoned() {
-        ZoneId zone = ZoneId.of("Pacific/Funafuti");
-
-        assertEquals("2020-08-24T08:45+12:00[Pacific/Funafuti]", DATETIME.withZone(zone).parse("2020-08-24T08:45:00").toString());
-        assertEquals("2020-08-24T18:45+12:00[Pacific/Funafuti]", DATETIME.withZone(zone).parse("2020-08-24T08:45:00+02:00[Poland]").toString());
-        assertEquals("2020-08-24T20:45+12:00[Pacific/Funafuti]", DATETIME.withZone(zone).parse("2020-08-24T08:45:00Z").toString());
-        assertEquals("2020-08-24T18:45+12:00[Pacific/Funafuti]", DATETIME.withZone(zone).parse("2020-08-24T08:45:00+06:00[Europe/Warsaw]").toString());
-        assertEquals("2020-08-24T18:45+12:00[Pacific/Funafuti]", DATETIME.withZone(zone).parse("2020-08-24T08:45:00+17:00[Europe/Warsaw]").toString());
-        assertEquals("2020-08-24T14:45+12:00[Pacific/Funafuti]", DATETIME.withZone(zone).parse("2020-08-24T08:45:00+06:00").toString());
-        assertEquals("2020-08-24T03:45+12:00[Pacific/Funafuti]", DATETIME.withZone(zone).parse("2020-08-24T08:45:00+17:00").toString());
+        assertEquals("2020-08-24T08:45+12:00[Tuvalu]", DATETIME.withZone(TV).parse("2020-08-24T08:45:00").toString());
+        assertEquals("2020-08-24T18:45+12:00[Tuvalu]", DATETIME.withZone(TV).parse("2020-08-24T08:45:00+02:00[Poland]").toString());
+        assertEquals("2020-08-24T20:45+12:00[Tuvalu]", DATETIME.withZone(TV).parse("2020-08-24T08:45:00Z").toString());
+        assertEquals("2020-08-24T18:45+12:00[Tuvalu]", DATETIME.withZone(TV).parse("2020-08-24T08:45:00+06:00[Europe/Warsaw]").toString());
+        assertEquals("2020-08-24T18:45+12:00[Tuvalu]", DATETIME.withZone(TV).parse("2020-08-24T08:45:00+17:00[Europe/Warsaw]").toString());
+        assertEquals("2020-08-24T14:45+12:00[Tuvalu]", DATETIME.withZone(TV).parse("2020-08-24T08:45:00+06:00").toString());
+        assertEquals("2020-08-24T03:45+12:00[Tuvalu]", DATETIME.withZone(TV).parse("2020-08-24T08:45:00+17:00").toString());
     }
 
     @Test
@@ -72,7 +68,7 @@ public class DateTimeParsersTest {
             DATE.parseDate("2024-10-16");
         });
         assertEquals("2020-08-16 [Poland]", DATE.parseDate("2020-08-16T20:45:00+02:00[Poland]").toString());
-        assertEquals("2020-08-16 [Z]", DATE.parseDate("2020-08-16T20:45:00Z").toString());
+        assertEquals("2020-08-16 [Z]",      DATE.parseDate("2020-08-16T20:45:00Z").toString());
         assertEquals("2020-08-16 [+06:00]", DATE.parseDate("2020-08-16T20:45:00+06:00").toString());
         assertEquals("2020-08-16 [+18:00]", DATE.parseDate("2020-08-16T20:45:00+18:00").toString());
         assertThrows(DateTimeParseException.class, () -> {
@@ -84,87 +80,78 @@ public class DateTimeParsersTest {
 
     @Test
     public void testParseDateSourced() {
-        ZoneId zone = ZoneId.of("Pacific/Funafuti");
-
-        assertEquals("2024-10-16 [Pacific/Funafuti]", DATE.withSourceZone(zone).parseDate("2024-10-16").toString());
-        assertEquals("2020-08-16 [Poland]", DATE.withSourceZone(zone).parseDate("2020-08-16T20:45:00+02:00[Poland]").toString());
-        assertEquals("2020-08-16 [Z]", DATE.withSourceZone(zone).parseDate("2020-08-16T20:45:00Z").toString());
-        assertEquals("2020-08-16 [+06:00]", DATE.withSourceZone(zone).parseDate("2020-08-16T20:45:00+06:00").toString());
-        assertEquals("2020-08-16 [+18:00]", DATE.withSourceZone(zone).parseDate("2020-08-16T20:45:00+18:00").toString());
-        assertEquals("2020-08-16 [Pacific/Funafuti]", DATE.withSourceZone(zone).parseDate("2020-08-16T20:45:00").toString());
-        assertEquals("2020-08-16 [Poland]", DATE.withSourceZone(zone).parseDate("2020-08-16+02:00[Poland]").toString());
-        assertEquals("2020-08-16 [+07:00]", DATE.withSourceZone(zone).parseDate("2020-08-16+07:00").toString());
+        assertEquals("2024-10-16 [Tuvalu]",   DATE.withSourceZone(TV).parseDate("2024-10-16").toString());
+        assertEquals("2020-08-16 [Poland]",   DATE.withSourceZone(TV).parseDate("2020-08-16T20:45:00+02:00[Poland]").toString());
+        assertEquals("2020-08-16 [Z]",        DATE.withSourceZone(TV).parseDate("2020-08-16T20:45:00Z").toString());
+        assertEquals("2020-08-16 [+06:00]",   DATE.withSourceZone(TV).parseDate("2020-08-16T20:45:00+06:00").toString());
+        assertEquals("2020-08-16 [+18:00]",   DATE.withSourceZone(TV).parseDate("2020-08-16T20:45:00+18:00").toString());
+        assertEquals("2020-08-16 [Tuvalu]",   DATE.withSourceZone(TV).parseDate("2020-08-16T20:45:00").toString());
+        assertEquals("2020-08-16 [Poland]",   DATE.withSourceZone(TV).parseDate("2020-08-16+02:00[Poland]").toString());
+        assertEquals("2020-08-16 [+07:00]",   DATE.withSourceZone(TV).parseDate("2020-08-16+07:00").toString());
     }
 
     @Test
     public void testParseDateTargeted() {
-        ZoneId zone = ZoneId.of("Pacific/Funafuti");
-
-        assertEquals("2024-10-16 [Pacific/Funafuti]", DATE.withTargetZone(zone).parseDate("2024-10-16").toString());
-        assertEquals("2020-08-17 [Pacific/Funafuti]", DATE.withTargetZone(zone).parseDate("2020-08-16T20:45:00+02:00[Poland]").toString());
-        assertEquals("2020-08-17 [Pacific/Funafuti]", DATE.withTargetZone(zone).parseDate("2020-08-16T20:45:00Z").toString());
-        assertEquals("2020-08-17 [Pacific/Funafuti]", DATE.withTargetZone(zone).parseDate("2020-08-16T20:45:00+06:00").toString());
-        assertEquals("2020-08-16 [Pacific/Funafuti]", DATE.withTargetZone(zone).parseDate("2020-08-16T20:45:00+18:00").toString());
-        assertEquals("2020-08-16 [Pacific/Funafuti]", DATE.withTargetZone(zone).parseDate("2020-08-16T20:45:00").toString());
+        assertEquals("2024-10-16 [Tuvalu]", DATE.withTargetZone(TV).parseDate("2024-10-16").toString());
+        assertEquals("2020-08-17 [Tuvalu]", DATE.withTargetZone(TV).parseDate("2020-08-16T20:45:00+02:00[Poland]").toString());
+        assertEquals("2020-08-17 [Tuvalu]", DATE.withTargetZone(TV).parseDate("2020-08-16T20:45:00Z").toString());
+        assertEquals("2020-08-17 [Tuvalu]", DATE.withTargetZone(TV).parseDate("2020-08-16T20:45:00+06:00").toString());
+        assertEquals("2020-08-16 [Tuvalu]", DATE.withTargetZone(TV).parseDate("2020-08-16T20:45:00+18:00").toString());
+        assertEquals("2020-08-16 [Tuvalu]", DATE.withTargetZone(TV).parseDate("2020-08-16T20:45:00").toString());
 
         assertThrows(DateTimeParseException.class, () -> {
-            DATE.withTargetZone(zone).parseDate("2020-08-16+02:00[Poland]");
+            DATE.withTargetZone(TV).parseDate("2020-08-16+02:00[Poland]");
         });
 
         assertThrows(DateTimeParseException.class, () -> {
-            DATE.withTargetZone(zone).parseDate("2020-08-16+07:00");
+            DATE.withTargetZone(TV).parseDate("2020-08-16+07:00");
         });
     }
 
     @Test
     public void testParseTimeDefault() {
-
         assertThrows(DateTimeParseException.class, () -> {
-            DateTimeFormat.TIME.parseTime("10:45");
+            TIME.parseTime("10:45");
         });
         assertThrows(DateTimeParseException.class, () -> {
-            DateTimeFormat.TIME.parseTime("2020-08-16T20:45:00");
+            TIME.parseTime("2020-08-16T20:45:00");
         });
 
-        assertEquals("20:45 [Poland]", DateTimeFormat.TIME.parseTime("2020-08-16T20:45:00+02:00[Poland]").toString());
-        assertEquals("20:45 [Z]",      DateTimeFormat.TIME.parseTime("2020-08-16T20:45:00Z").toString());
-        assertEquals("20:45 [+06:00]", DateTimeFormat.TIME.parseTime("2020-08-16T20:45:00+06:00").toString());
-        assertEquals("20:45 [+18:00]", DateTimeFormat.TIME.parseTime("2020-08-16T20:45:00+18:00").toString());
-        assertEquals("20:45 [+06:00]", DateTimeFormat.TIME.parseTime("20:45:00+06:00").toString());
-        assertEquals("20:45 [Europe/Astrakhan]", DateTimeFormat.TIME.parseTime("20:45:00+04:00[Europe/Astrakhan]").toString());
+        assertEquals("20:45 [Poland]",              TIME.parseTime("2020-08-16T20:45:00+02:00[Poland]").toString());
+        assertEquals("20:45 [Z]",                   TIME.parseTime("2020-08-16T20:45:00Z").toString());
+        assertEquals("20:45 [+06:00]",              TIME.parseTime("2020-08-16T20:45:00+06:00").toString());
+        assertEquals("20:45 [+18:00]",              TIME.parseTime("2020-08-16T20:45:00+18:00").toString());
+        assertEquals("20:45 [+06:00]",              TIME.parseTime("20:45:00+06:00").toString());
+        assertEquals("20:45 [Europe/Astrakhan]",    TIME.parseTime("20:45:00+04:00[Europe/Astrakhan]").toString());
     }
 
     @Test
     public void testParseTimeSourced() {
-        ZoneId zone = ZoneId.of("Pacific/Funafuti");
-
-        assertEquals("10:45 [Pacific/Funafuti]", DateTimeFormat.TIME.withSourceZone(zone).parseTime("10:45").toString());
-        assertEquals("20:45 [Pacific/Funafuti]", DateTimeFormat.TIME.withSourceZone(zone).parseTime("2020-08-16T20:45:00").toString());
-        assertEquals("20:45 [Poland]", DateTimeFormat.TIME.withSourceZone(zone).parseTime("2020-08-16T20:45:00+02:00[Poland]").toString());
-        assertEquals("20:45 [Z]", DateTimeFormat.TIME.withSourceZone(zone).parseTime("2020-08-16T20:45:00Z").toString());
-        assertEquals("20:45 [+06:00]", DateTimeFormat.TIME.withSourceZone(zone).parseTime("2020-08-16T20:45:00+06:00").toString());
-        assertEquals("20:45 [+18:00]", DateTimeFormat.TIME.withSourceZone(zone).parseTime("2020-08-16T20:45:00+18:00").toString());
-        assertEquals("20:45 [+06:00]", DateTimeFormat.TIME.withSourceZone(zone).parseTime("20:45:00+06:00").toString());
-        assertEquals("20:45 [Europe/Astrakhan]", DateTimeFormat.TIME.withSourceZone(zone).parseTime("20:45:00+04:00[Europe/Astrakhan]").toString());
+        assertEquals("10:45 [Tuvalu]",              TIME.withSourceZone(TV).parseTime("10:45").toString());
+        assertEquals("20:45 [Tuvalu]",              TIME.withSourceZone(TV).parseTime("2020-08-16T20:45:00").toString());
+        assertEquals("20:45 [Poland]",              TIME.withSourceZone(TV).parseTime("2020-08-16T20:45:00+02:00[Poland]").toString());
+        assertEquals("20:45 [Z]",                   TIME.withSourceZone(TV).parseTime("2020-08-16T20:45:00Z").toString());
+        assertEquals("20:45 [+06:00]",              TIME.withSourceZone(TV).parseTime("2020-08-16T20:45:00+06:00").toString());
+        assertEquals("20:45 [+18:00]",              TIME.withSourceZone(TV).parseTime("2020-08-16T20:45:00+18:00").toString());
+        assertEquals("20:45 [+06:00]",              TIME.withSourceZone(TV).parseTime("20:45:00+06:00").toString());
+        assertEquals("20:45 [Europe/Astrakhan]",    TIME.withSourceZone(TV).parseTime("20:45:00+04:00[Europe/Astrakhan]").toString());
     }
 
     @Test
     public void testParseTimeTargeted() {
-        ZoneId zone = ZoneId.of("Pacific/Funafuti");
-
         assertThrows(DateTimeParseException.class, () -> {
-            DateTimeFormat.TIME.withTargetZone(zone).parseTime("20:45:00+06:00");
+            TIME.withTargetZone(TV).parseTime("20:45:00+06:00");
         });
         assertThrows(DateTimeParseException.class, () -> {
-            DateTimeFormat.TIME.withTargetZone(zone).parseTime("20:45:00+04:00[Europe/Astrakhan]");
+            TIME.withTargetZone(TV).parseTime("20:45:00+04:00[Europe/Astrakhan]");
         });
 
-        assertEquals("10:45 [Pacific/Funafuti]", DateTimeFormat.TIME.withTargetZone(zone).parseTime("10:45").toString());
-        assertEquals("06:45 [Pacific/Funafuti]", DateTimeFormat.TIME.withTargetZone(zone).parseTime("2020-08-16T20:45:00+02:00[Poland]").toString());
-        assertEquals("08:45 [Pacific/Funafuti]", DateTimeFormat.TIME.withTargetZone(zone).parseTime("2020-08-16T20:45:00Z").toString());
-        assertEquals("02:45 [Pacific/Funafuti]", DateTimeFormat.TIME.withTargetZone(zone).parseTime("2020-08-16T20:45:00+06:00").toString());
-        assertEquals("14:45 [Pacific/Funafuti]", DateTimeFormat.TIME.withTargetZone(zone).parseTime("2020-08-16T20:45:00+18:00").toString());
-        assertEquals("20:45 [Pacific/Funafuti]", DateTimeFormat.TIME.withTargetZone(zone).parseTime("2020-08-16T20:45:00").toString());
+        assertEquals("10:45 [Tuvalu]", TIME.withTargetZone(TV).parseTime("10:45").toString());
+        assertEquals("06:45 [Tuvalu]", TIME.withTargetZone(TV).parseTime("2020-08-16T20:45:00+02:00[Poland]").toString());
+        assertEquals("08:45 [Tuvalu]", TIME.withTargetZone(TV).parseTime("2020-08-16T20:45:00Z").toString());
+        assertEquals("02:45 [Tuvalu]", TIME.withTargetZone(TV).parseTime("2020-08-16T20:45:00+06:00").toString());
+        assertEquals("14:45 [Tuvalu]", TIME.withTargetZone(TV).parseTime("2020-08-16T20:45:00+18:00").toString());
+        assertEquals("20:45 [Tuvalu]", TIME.withTargetZone(TV).parseTime("2020-08-16T20:45:00").toString());
     }
 
 }