Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 09540649 authored by Brad Ebinger's avatar Brad Ebinger
Browse files

Fix unit tests to not depend on ImsConfig

Bug: 77941698
Test: atest FrameworkTelephonyTests
Change-Id: If267a530726e9de8681a1223e6e16e6af21d8605
parent 0c65c655
Loading
Loading
Loading
Loading
+2 −7
Original line number Diff line number Diff line
@@ -62,7 +62,6 @@ public class ImsManagerTest extends TelephonyTest {
    Hashtable<Integer, Integer> mProvisionedIntVals = new Hashtable<>();
    Hashtable<Integer, String> mProvisionedStringVals = new Hashtable<>();
    ImsConfigImplBase.ImsConfigStub mImsConfigStub;
    ImsConfig mImsConfig;
    @Mock MmTelFeatureConnection mMmTelFeatureConnection;

    private final int[] mSubId = {0};
@@ -272,7 +271,7 @@ public class ImsManagerTest extends TelephonyTest {
                eq(ImsConfig.WfcModeFeatureValueConstants.CELLULAR_PREFERRED));
    }

    private ImsManager initializeProvisionedValues() {
    private ImsManager initializeProvisionedValues() throws Exception {
        when(mImsConfigImplBaseMock.getConfigInt(anyInt()))
                .thenAnswer(invocation ->  {
                    return getProvisionedInt((Integer) (invocation.getArguments()[0]));
@@ -288,15 +287,11 @@ public class ImsManagerTest extends TelephonyTest {

        // Configure ImsConfigStub
        mImsConfigStub = new ImsConfigImplBase.ImsConfigStub(mImsConfigImplBaseMock);
        doReturn(mImsConfigStub).when(mImsConfigImplBaseMock).getIImsConfig();

        // Configure ImsConfig
        mImsConfig = new ImsConfig(mImsConfigStub, mContext);
        doReturn(mImsConfigStub).when(mMmTelFeatureConnection).getConfigInterface();

        // Configure ImsManager
        ImsManager imsManager = ImsManager.getInstance(mContext, mPhoneId);
        try {
            replaceInstance(ImsManager.class, "mConfig", imsManager, mImsConfig);
            replaceInstance(ImsManager.class, "mMmTelFeatureConnection", imsManager,
                    mMmTelFeatureConnection);
        } catch (Exception ex) {