diff options
author | Neil Fuller <nfuller@google.com> | 2014-07-18 12:15:30 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-07-17 19:45:26 +0000 |
commit | ec0d62c123863f63a184106a03e0cc6ea1c4690e (patch) | |
tree | 31b51e579496bedbbf688d0b7cf1c6d2f022ab99 /luni/src/test/java | |
parent | 990ac8b4dc540409d8421840ddd460c1c5586445 (diff) | |
parent | 60226561d5af59bc47ee70a4988633050e6fc62e (diff) | |
download | libcore-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.java | 23 |
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()); } |