summaryrefslogtreecommitdiffstats
path: root/luni/src/test/java
diff options
context:
space:
mode:
authorNeil Fuller <nfuller@google.com>2014-07-18 12:15:30 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-07-17 19:45:26 +0000
commitec0d62c123863f63a184106a03e0cc6ea1c4690e (patch)
tree31b51e579496bedbbf688d0b7cf1c6d2f022ab99 /luni/src/test/java
parent990ac8b4dc540409d8421840ddd460c1c5586445 (diff)
parent60226561d5af59bc47ee70a4988633050e6fc62e (diff)
downloadlibcore-ec0d62c123863f63a184106a03e0cc6ea1c4690e.zip
libcore-ec0d62c123863f63a184106a03e0cc6ea1c4690e.tar.gz
libcore-ec0d62c123863f63a184106a03e0cc6ea1c4690e.tar.bz2
Merge "Add a cache for ZoneInfo objects in Java" into lmp-dev
Diffstat (limited to 'luni/src/test/java')
-rw-r--r--luni/src/test/java/libcore/util/ZoneInfoDBTest.java23
1 files changed, 23 insertions, 0 deletions
diff --git a/luni/src/test/java/libcore/util/ZoneInfoDBTest.java b/luni/src/test/java/libcore/util/ZoneInfoDBTest.java
index 215821d..9875647 100644
--- a/luni/src/test/java/libcore/util/ZoneInfoDBTest.java
+++ b/luni/src/test/java/libcore/util/ZoneInfoDBTest.java
@@ -77,6 +77,29 @@ public class ZoneInfoDBTest extends junit.framework.TestCase {
}
}
+ // Confirms any caching that exists correctly handles TimeZone mutability.
+ public void testMakeTimeZone_timeZoneMutability() throws Exception {
+ ZoneInfoDB.TzData data = new ZoneInfoDB.TzData(TZDATA_IN_ROOT);
+ String tzId = "Europe/London";
+ ZoneInfo first = data.makeTimeZone(tzId);
+ ZoneInfo second = data.makeTimeZone(tzId);
+ assertNotSame(first, second);
+
+ assertTrue(first.hasSameRules(second));
+
+ first.setID("Not Europe/London");
+
+ assertFalse(first.getID().equals(second.getID()));
+
+ first.setRawOffset(3600);
+ assertFalse(first.getRawOffset() == second.getRawOffset());
+ }
+
+ public void testMakeTimeZone_notFound() throws Exception {
+ ZoneInfoDB.TzData data = new ZoneInfoDB.TzData(TZDATA_IN_ROOT);
+ assertNull(data.makeTimeZone("THIS_TZ_DOES_NOT_EXIST"));
+ }
+
private static String makeCorruptFile() throws Exception {
return makeTemporaryFile("invalid content".getBytes());
}