| 28 | |
| 29 | |
| 30 | @RunWith(JUnit4.class) |
| 31 | public class WindowsZoneTest { |
| 32 | |
| 33 | @Test |
| 34 | public void getVersion() { |
| 35 | assertThat( |
| 36 | WindowsZone.getVersion(), |
| 37 | is("$Revision$ (2021a)")); // CLDR 39 |
| 38 | } |
| 39 | |
| 40 | @Test(expected=UnsupportedOperationException.class) |
| 41 | public void getAvailableNamesIsUnmodifiable() { |
| 42 | Set<String> names = WindowsZone.getAvailableNames(); |
| 43 | System.out.println("windows-zones=" + names); |
| 44 | names.clear(); |
| 45 | } |
| 46 | |
| 47 | @Test |
| 48 | public void loadAll() { |
| 49 | for (TZID tzid : Timezone.getAvailableIDs("WINDOWS")) { |
| 50 | try { |
| 51 | Timezone.of(tzid); |
| 52 | } catch (RuntimeException ex) { |
| 53 | fail(ex.getMessage()); |
| 54 | } |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | @Test(expected=IllegalArgumentException.class) |
| 59 | public void ofInvalidNameXYZ() { |
| 60 | WindowsZone.of("xyz"); |
| 61 | } |
| 62 | |
| 63 | @Test(expected=IllegalArgumentException.class) |
| 64 | public void ofInvalidNameAsWinID() { |
| 65 | WindowsZone.of("WINDOWS~America/New_York"); |
| 66 | } |
| 67 | |
| 68 | @Test(expected=IllegalArgumentException.class) |
| 69 | public void ofInvalidNameAsOlsonID() { |
| 70 | WindowsZone.of("America/New_York"); |
| 71 | } |
| 72 | |
| 73 | @Test |
| 74 | public void testToString() { |
| 75 | String name = "Eastern Standard Time"; |
| 76 | WindowsZone wzn = WindowsZone.of(name); |
| 77 | assertThat( |
| 78 | wzn.toString(), |
| 79 | is(name)); |
| 80 | } |
| 81 | |
| 82 | @Test |
| 83 | public void resolveSmartUS1() { |
| 84 | WindowsZone wzn = WindowsZone.of("Eastern Standard Time"); |
| 85 | assertThat( |
| 86 | wzn.resolveSmart(Locale.US).get().canonical(), |
| 87 | is("WINDOWS~America/New_York")); |
nothing calls this directly
no outgoing calls
no test coverage detected