Fix the testcase failed

Add mock for SubscriptionManager.createForAllUserProfiles

Bug: 323652989
Test: atest MobileNetworkPreferenceControllerTest
Change-Id: I96574a79eba581db95d387f0d9c9fde2e004c41c
This commit is contained in:
songferngwang
2024-03-04 10:58:22 +00:00
parent 0d7d180246
commit c9a3eeb792

View File

@@ -78,6 +78,7 @@ public class MobileNetworkPreferenceControllerTest {
mContext = spy(ApplicationProvider.getApplicationContext());
when(mContext.getSystemService(Context.TELEPHONY_SERVICE)).thenReturn(mTelephonyManager);
when(mContext.getSystemService(SubscriptionManager.class)).thenReturn(mSubscriptionManager);
when(mSubscriptionManager.createForAllUserProfiles()).thenReturn(mSubscriptionManager);
when(mContext.getSystemService(UserManager.class)).thenReturn(mUserManager);
if (Looper.myLooper() == null) {
Looper.prepare();