Merge "Fix Robo test failure in NrDisabledInDsdsFooterPreferenceControllerTest." into rvc-dev am: 3f900d8a7c
am: f517296374
Change-Id: I1bc4aafc09da386370c5fd7b71dfeea5f3c5982e
This commit is contained in:
committed by
Automerger Merge Worker
commit
f200941e5b
@@ -24,6 +24,7 @@ import static org.mockito.Mockito.spy;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import android.content.Context;
|
||||
import android.telephony.SubscriptionManager;
|
||||
import android.telephony.TelephonyManager;
|
||||
|
||||
import org.junit.Before;
|
||||
@@ -43,6 +44,8 @@ public class NrDisabledInDsdsFooterPreferenceControllerTest {
|
||||
private Context mContext;
|
||||
@Mock
|
||||
private TelephonyManager mTelephonyManager;
|
||||
@Mock
|
||||
private SubscriptionManager mSubscriptionManager;
|
||||
private NrDisabledInDsdsFooterPreferenceController mController;
|
||||
|
||||
@Before
|
||||
@@ -50,6 +53,8 @@ public class NrDisabledInDsdsFooterPreferenceControllerTest {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
mContext = spy(RuntimeEnvironment.application);
|
||||
doReturn(mTelephonyManager).when(mContext).getSystemService(Context.TELEPHONY_SERVICE);
|
||||
doReturn(mSubscriptionManager).when(mContext).getSystemService(
|
||||
Context.TELEPHONY_SUBSCRIPTION_SERVICE);
|
||||
doReturn(mTelephonyManager).when(mTelephonyManager).createForSubscriptionId(anyInt());
|
||||
mController = new NrDisabledInDsdsFooterPreferenceController(mContext, PREF_KEY);
|
||||
}
|
||||
@@ -64,7 +69,7 @@ public class NrDisabledInDsdsFooterPreferenceControllerTest {
|
||||
public void isAvailable_dataOnAndDsdsAnd5GSupported_Available() {
|
||||
when(mTelephonyManager.getSupportedRadioAccessFamily())
|
||||
.thenReturn(TelephonyManager.NETWORK_TYPE_BITMASK_NR);
|
||||
when(mTelephonyManager.getActiveModemCount()).thenReturn(2);
|
||||
when(mSubscriptionManager.getActiveSubscriptionIdList()).thenReturn(new int[] {1, 2});
|
||||
when(mTelephonyManager.isDataEnabled()).thenReturn(true);
|
||||
mController.init(SUB_ID);
|
||||
assertThat(mController.isAvailable()).isTrue();
|
||||
@@ -74,7 +79,7 @@ public class NrDisabledInDsdsFooterPreferenceControllerTest {
|
||||
public void isAvailable_5gNotSupported_notAvailable() {
|
||||
when(mTelephonyManager.getSupportedRadioAccessFamily())
|
||||
.thenReturn(TelephonyManager.NETWORK_TYPE_BITMASK_LTE);
|
||||
when(mTelephonyManager.getActiveModemCount()).thenReturn(2);
|
||||
when(mSubscriptionManager.getActiveSubscriptionIdList()).thenReturn(new int[] {1, 2});
|
||||
when(mTelephonyManager.isDataEnabled()).thenReturn(true);
|
||||
mController.init(SUB_ID);
|
||||
assertThat(mController.isAvailable()).isFalse();
|
||||
@@ -84,7 +89,7 @@ public class NrDisabledInDsdsFooterPreferenceControllerTest {
|
||||
public void isAvailable_mobileDataOff_notAvailable() {
|
||||
when(mTelephonyManager.getSupportedRadioAccessFamily())
|
||||
.thenReturn(TelephonyManager.NETWORK_TYPE_BITMASK_NR);
|
||||
when(mTelephonyManager.getActiveModemCount()).thenReturn(2);
|
||||
when(mSubscriptionManager.getActiveSubscriptionIdList()).thenReturn(new int[] {1, 2});
|
||||
when(mTelephonyManager.isDataEnabled()).thenReturn(false);
|
||||
mController.init(SUB_ID);
|
||||
assertThat(mController.isAvailable()).isFalse();
|
||||
@@ -94,7 +99,7 @@ public class NrDisabledInDsdsFooterPreferenceControllerTest {
|
||||
public void isAvailable_singleSimMode_notAvailable() {
|
||||
when(mTelephonyManager.getSupportedRadioAccessFamily())
|
||||
.thenReturn(TelephonyManager.NETWORK_TYPE_BITMASK_NR);
|
||||
when(mTelephonyManager.getActiveModemCount()).thenReturn(1);
|
||||
when(mSubscriptionManager.getActiveSubscriptionIdList()).thenReturn(new int[] {1});
|
||||
when(mTelephonyManager.isDataEnabled()).thenReturn(true);
|
||||
mController.init(SUB_ID);
|
||||
assertThat(mController.isAvailable()).isFalse();
|
||||
|
Reference in New Issue
Block a user