Esempio n. 1
0
 // -----------------------------------------------------------------------
 // getRules(String, boolean)
 // -----------------------------------------------------------------------
 @Test
 public void test_getRules_StringBoolean() {
   ZoneRules rules = ZoneRulesProvider.getRules("Europe/London", false);
   assertNotNull(rules);
   ZoneRules rules2 = ZoneRulesProvider.getRules("Europe/London", false);
   assertEquals(rules2, rules);
 }
Esempio n. 2
0
 // -----------------------------------------------------------------------
 // registerProvider()
 // -----------------------------------------------------------------------
 @Test(groups = {"tck"})
 public void test_registerProvider() {
   Set<String> pre = ZoneRulesProvider.getAvailableZoneIds();
   assertEquals(pre.contains("FooLocation"), false);
   ZoneRulesProvider.registerProvider(new MockTempProvider());
   assertEquals(pre.contains("FooLocation"), false);
   Set<String> post = ZoneRulesProvider.getAvailableZoneIds();
   assertEquals(post.contains("FooLocation"), true);
   assertEquals(
       ZoneRulesProvider.getRules("FooLocation", false), ZoneOffset.of("+01:45").getRules());
 }
Esempio n. 3
0
  // -----------------------------------------------------------------------
  // getVersions(String)
  // -----------------------------------------------------------------------
  @Test
  public void test_getVersions_String() {
    NavigableMap<String, ZoneRules> versions = ZoneRulesProvider.getVersions("Europe/London");
    assertTrue(versions.size() >= 1);
    ZoneRules rules = ZoneRulesProvider.getRules("Europe/London", false);
    assertEquals(versions.lastEntry().getValue(), rules);

    NavigableMap<String, ZoneRules> copy = new TreeMap<>(versions);
    versions.clear();
    assertEquals(versions.size(), 0);
    NavigableMap<String, ZoneRules> versions2 = ZoneRulesProvider.getVersions("Europe/London");
    assertEquals(versions2, copy);
  }
Esempio n. 4
0
 @Test(expectedExceptions = NullPointerException.class)
 public void test_getRules_StringBoolean_null() {
   ZoneRulesProvider.getRules(null, false);
 }
Esempio n. 5
0
 @Test(expectedExceptions = ZoneRulesException.class)
 public void test_getRules_StringBoolean_unknownId() {
   ZoneRulesProvider.getRules("Europe/Lon", false);
 }