From 571d9b1f377c6046c11c7e12cfec70e5af2c82af Mon Sep 17 00:00:00 2001 From: Weng Su Date: Thu, 11 May 2023 20:43:34 +0800 Subject: [PATCH] Fix failing test case in AllInOneTetherSettingsTest - Add the necessary mock classes Bug: 280067520 Test: Manual test atest -c AllInOneTetherSettingsTest Change-Id: I6576c6997b43103ea810008b7a1a245e3e42015c --- .../src/com/android/settings/AllInOneTetherSettingsTest.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/robotests/src/com/android/settings/AllInOneTetherSettingsTest.java b/tests/robotests/src/com/android/settings/AllInOneTetherSettingsTest.java index 01ec42e6a94..f2a55c1d935 100644 --- a/tests/robotests/src/com/android/settings/AllInOneTetherSettingsTest.java +++ b/tests/robotests/src/com/android/settings/AllInOneTetherSettingsTest.java @@ -45,6 +45,8 @@ import androidx.preference.PreferenceGroup; import androidx.preference.PreferenceScreen; import com.android.settings.core.FeatureFlags; +import com.android.settings.testutils.FakeFeatureFactory; +import com.android.settings.wifi.repository.WifiHotspotRepository; import com.android.settings.wifi.tether.WifiTetherAutoOffPreferenceController; import com.android.settings.wifi.tether.WifiTetherSecurityPreferenceController; import com.android.settingslib.core.lifecycle.Lifecycle; @@ -93,6 +95,8 @@ public class AllInOneTetherSettingsTest { mContext = spy(RuntimeEnvironment.application); MockitoAnnotations.initMocks(this); + when(FakeFeatureFactory.setupForTest().getWifiFeatureProvider().getWifiHotspotRepository()) + .thenReturn(mock(WifiHotspotRepository.class)); doReturn(mWifiManager).when(mContext).getSystemService(WifiManager.class); doReturn(mConnectivityManager) .when(mContext).getSystemService(Context.CONNECTIVITY_SERVICE);