Merge "Track core platform API change" am: 1d45573eb2 am: 83d7191a22

Original change: https://android-review.googlesource.com/c/platform/packages/apps/Settings/+/1367136

Change-Id: I7cb7175a827aae27836324e0865c9a6d5ff6b5ed
This commit is contained in:
Neil Fuller
2020-07-20 15:07:02 +00:00
committed by Automerger Merge Worker

View File

@@ -21,6 +21,8 @@ import static com.google.common.truth.Truth.assertThat;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
import static java.util.Collections.emptyList;
import com.android.i18n.timezone.CountryTimeZones; import com.android.i18n.timezone.CountryTimeZones;
import com.android.i18n.timezone.CountryTimeZones.TimeZoneMapping; import com.android.i18n.timezone.CountryTimeZones.TimeZoneMapping;
import com.android.i18n.timezone.CountryZonesFinder; import com.android.i18n.timezone.CountryZonesFinder;
@@ -49,7 +51,7 @@ public class TimeZoneDataTest {
public void testRegionsWithTimeZone() { public void testRegionsWithTimeZone() {
TimeZoneData timeZoneData = new TimeZoneData(mCountryZonesFinder); TimeZoneData timeZoneData = new TimeZoneData(mCountryZonesFinder);
CountryTimeZones countryTimeZones = mock(CountryTimeZones.class); CountryTimeZones countryTimeZones = mock(CountryTimeZones.class);
when(countryTimeZones.getTimeZoneMappings()).thenReturn(Collections.emptyList()); when(countryTimeZones.getTimeZoneMappings()).thenReturn(emptyList());
when(mCountryZonesFinder.lookupCountryTimeZones("US")).thenReturn(countryTimeZones); when(mCountryZonesFinder.lookupCountryTimeZones("US")).thenReturn(countryTimeZones);
assertThat(timeZoneData.lookupCountryTimeZones("US").getCountryTimeZones()) assertThat(timeZoneData.lookupCountryTimeZones("US").getCountryTimeZones())
.isSameAs(countryTimeZones); .isSameAs(countryTimeZones);
@@ -57,7 +59,7 @@ public class TimeZoneDataTest {
@Test @Test
public void testGetRegionIds() { public void testGetRegionIds() {
when(mCountryZonesFinder.lookupAllCountryIsoCodes()).thenReturn(Collections.emptyList()); when(mCountryZonesFinder.lookupAllCountryIsoCodes()).thenReturn(emptyList());
TimeZoneData timeZoneData = new TimeZoneData(mCountryZonesFinder); TimeZoneData timeZoneData = new TimeZoneData(mCountryZonesFinder);
assertThat(timeZoneData.getRegionIds()).isEmpty(); assertThat(timeZoneData.getRegionIds()).isEmpty();
@@ -73,13 +75,16 @@ public class TimeZoneDataTest {
CountryTimeZones US = mock(CountryTimeZones.class); CountryTimeZones US = mock(CountryTimeZones.class);
when(US.getCountryIso()).thenReturn("us"); when(US.getCountryIso()).thenReturn("us");
when(US.getTimeZoneMappings()).thenReturn(Arrays.asList( when(US.getTimeZoneMappings()).thenReturn(Arrays.asList(
TimeZoneMapping.createForTests("Unknown/Secret_City", true, null /* notUsedAfter */), TimeZoneMapping.createForTests(
TimeZoneMapping.createForTests("Unknown/Secret_City2", false, null /* notUsedAfter */) "Unknown/Secret_City", true, null /* notUsedAfter */, emptyList()),
TimeZoneMapping.createForTests(
"Unknown/Secret_City2", false, null /* notUsedAfter */, emptyList())
)); ));
CountryTimeZones GB = mock(CountryTimeZones.class); CountryTimeZones GB = mock(CountryTimeZones.class);
when(GB.getCountryIso()).thenReturn("gb"); when(GB.getCountryIso()).thenReturn("gb");
when(GB.getTimeZoneMappings()).thenReturn(Collections.singletonList( when(GB.getTimeZoneMappings()).thenReturn(Collections.singletonList(
TimeZoneMapping.createForTests("Unknown/Secret_City", true, null /* notUsedAfter */) TimeZoneMapping.createForTests(
"Unknown/Secret_City", true, null /* notUsedAfter */, emptyList())
)); ));
when(mCountryZonesFinder.lookupCountryTimeZonesForZoneId("Unknown/Secret_City")) when(mCountryZonesFinder.lookupCountryTimeZonesForZoneId("Unknown/Secret_City"))
.thenReturn(Arrays.asList(US, GB)); .thenReturn(Arrays.asList(US, GB));