-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathAndroidTimeZonesTest.kt
More file actions
37 lines (31 loc) · 1.13 KB
/
AndroidTimeZonesTest.kt
File metadata and controls
37 lines (31 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
* This file is part of bitfireAT/synctools which is released under GPLv3.
* Copyright © All Contributors. See the LICENSE and AUTHOR files in the root directory for details.
* SPDX-License-Identifier: GPL-3.0-or-later
*/
package at.bitfire.ical4android
import net.fortuna.ical4j.model.TimeZoneRegistryFactory
import org.junit.Assert
import org.junit.Test
import java.time.ZoneId
import java.time.format.TextStyle
import java.util.Locale
import java.util.logging.Logger
class AndroidTimeZonesTest {
private val logger
get() = Logger.getLogger(javaClass.name)
@Test
fun testLoadSystemTimezones() {
val tzRegistry = TimeZoneRegistryFactory.getInstance().createRegistry()
for (id in ZoneId.getAvailableZoneIds()) {
val name = ZoneId.of(id).getDisplayName(TextStyle.FULL, Locale.US)
val info = try {
tzRegistry.getTimeZone(id)
} catch(_: Exception) {
Assert.fail("Invalid system timezone $name ($id)")
}
if (info == null)
logger.warning("ical4j can't load system timezone $name ($id)")
}
}
}