diff --git a/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherFooterPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherFooterPreferenceControllerTest.java index a42307193ec..c1d6c16a687 100644 --- a/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherFooterPreferenceControllerTest.java +++ b/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherFooterPreferenceControllerTest.java @@ -17,6 +17,7 @@ package com.android.settings.wifi.tether; import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -57,7 +58,8 @@ public class WifiTetherFooterPreferenceControllerTest { public void setUp() { MockitoAnnotations.initMocks(this); - when(mContext.getSystemService(Context.WIFI_SERVICE)).thenReturn(mWifiManager); + doReturn(mWifiManager).when(mContext).getSystemService(WifiManager.class); + doReturn(mTetheringManager).when(mContext).getSystemService(TetheringManager.class); when(mContext.getSystemService(Context.TETHERING_SERVICE)).thenReturn(mTetheringManager); when(mTetheringManager.getTetherableWifiRegexs()).thenReturn(new String[]{"1", "2"}); mController = new WifiTetherFooterPreferenceController(mContext);