diff options
author | Roshan Pius <rpius@google.com> | 2019-11-14 08:15:05 -0800 |
---|---|---|
committer | Roshan Pius <rpius@google.com> | 2019-11-14 12:25:42 -0800 |
commit | 1cc318d4e1cca2ee993f62536869e3659a1aa659 (patch) | |
tree | 3985b15a912b3b85778d9e6bb1a140e8f866f6a7 /tests | |
parent | 9facd6b1bcb008c6581da5a43362122501016536 (diff) |
TelephonyUtil: Use public API for isSimPresent
Bug: 142935310
Test: atest com.android.server.wifi
Change-Id: I07e23d125105346485ca9bebdc80baff1ab82918
Diffstat (limited to 'tests')
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/util/TelephonyUtilTest.java | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/util/TelephonyUtilTest.java b/tests/wifitests/src/com/android/server/wifi/util/TelephonyUtilTest.java index 5cff6d3d1..b31bb057e 100644 --- a/tests/wifitests/src/com/android/server/wifi/util/TelephonyUtilTest.java +++ b/tests/wifitests/src/com/android/server/wifi/util/TelephonyUtilTest.java @@ -49,6 +49,7 @@ import org.mockito.quality.Strictness; import java.security.PublicKey; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; import java.util.List; @@ -652,8 +653,12 @@ public class TelephonyUtilTest extends WifiBaseTest { */ @Test public void isSimPresentWithValidSubscriptionIdList() { - when(mSubscriptionManager.getActiveSubscriptionIdList()) - .thenReturn(new int[] {DATA_SUBID, NON_DATA_SUBID}); + SubscriptionInfo subInfo1 = mock(SubscriptionInfo.class); + when(subInfo1.getSubscriptionId()).thenReturn(DATA_SUBID); + SubscriptionInfo subInfo2 = mock(SubscriptionInfo.class); + when(subInfo2.getSubscriptionId()).thenReturn(NON_DATA_SUBID); + when(mSubscriptionManager.getActiveSubscriptionInfoList()) + .thenReturn(Arrays.asList(subInfo1, subInfo2)); assertTrue(mTelephonyUtil.isSimPresent(DATA_SUBID)); } @@ -663,13 +668,15 @@ public class TelephonyUtilTest extends WifiBaseTest { */ @Test public void isSimPresentWithInvalidOrEmptySubscriptionIdList() { - when(mSubscriptionManager.getActiveSubscriptionIdList()) - .thenReturn(new int[]{}); + when(mSubscriptionManager.getActiveSubscriptionInfoList()) + .thenReturn(Collections.emptyList()); assertFalse(mTelephonyUtil.isSimPresent(DATA_SUBID)); - when(mSubscriptionManager.getActiveSubscriptionIdList()) - .thenReturn(new int[]{NON_DATA_SUBID}); + SubscriptionInfo subInfo = mock(SubscriptionInfo.class); + when(subInfo.getSubscriptionId()).thenReturn(NON_DATA_SUBID); + when(mSubscriptionManager.getActiveSubscriptionInfoList()) + .thenReturn(Arrays.asList(subInfo)); assertFalse(mTelephonyUtil.isSimPresent(DATA_SUBID)); } |