1/* 2 * Copyright (C) 2017 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17package libcore.libcore.util; 18 19import org.junit.Test; 20 21import libcore.util.TimeZoneDataFiles; 22 23import static org.junit.Assert.assertEquals; 24import static org.junit.Assert.assertTrue; 25 26public class TimeZoneDataFilesTest { 27 28 @Test 29 public void getTimeZoneFilePaths() { 30 String[] paths = TimeZoneDataFiles.getTimeZoneFilePaths("foo"); 31 assertEquals(2, paths.length); 32 33 assertTrue(paths[0].contains("/misc/zoneinfo/current/")); 34 assertTrue(paths[0].endsWith("foo")); 35 36 assertTrue(paths[1].contains("/usr/share/zoneinfo/")); 37 assertTrue(paths[1].endsWith("foo")); 38 } 39 40 // http://b/34867424 41 @Test 42 public void generateIcuDataPath_includesTimeZoneOverride() { 43 String icuDataPath = System.getProperty("android.icu.impl.ICUBinary.dataPath"); 44 assertEquals(icuDataPath, TimeZoneDataFiles.generateIcuDataPath()); 45 46 String[] paths = icuDataPath.split(":"); 47 assertEquals(2, paths.length); 48 49 assertTrue(paths[0].contains("/misc/zoneinfo/current/icu")); 50 assertTrue(paths[1].contains("/usr/icu")); 51 } 52} 53