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

Commit 05f4069d authored by Hall Liu's avatar Hall Liu
Browse files

Inject dependencies into TelephonyRegistry

Inject the system config dependencies into TelephonyRegistry during
testing.

Bug: 152074216
Test: atest FrameworksTelephonyTests:TelephonyRegistryTest
Change-Id: Ib311e439a6dcedacdda144e7ee2c45652d966404
parent 6ff894b7
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

import android.content.Intent;
@@ -151,7 +152,12 @@ public class TelephonyRegistryTest extends TelephonyTest {
    @Before
    public void setUp() throws Exception {
        super.setUp("TelephonyRegistryTest");
        mTelephonyRegistry = new TelephonyRegistry(mContext);
        TelephonyRegistry.ConfigurationProvider mockConfigurationProvider =
                mock(TelephonyRegistry.ConfigurationProvider.class);
        when(mockConfigurationProvider.getRegistrationLimit()).thenReturn(-1);
        when(mockConfigurationProvider.isRegistrationLimitEnabledInPlatformCompat(anyInt()))
                .thenReturn(false);
        mTelephonyRegistry = new TelephonyRegistry(mContext, mockConfigurationProvider);
        addTelephonyRegistryService();
        mPhoneStateListener = new PhoneStateListenerWrapper();
        processAllMessages();