Merge "Fix WifiTetherFooterPreferenceControllerTest failed" into sc-dev

This commit is contained in:
Weng Su
2021-03-30 03:02:09 +00:00
committed by Android (Google) Code Review

View File

@@ -17,6 +17,7 @@
package com.android.settings.wifi.tether; package com.android.settings.wifi.tether;
import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.never; import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
@@ -57,7 +58,8 @@ public class WifiTetherFooterPreferenceControllerTest {
public void setUp() { public void setUp() {
MockitoAnnotations.initMocks(this); 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(mContext.getSystemService(Context.TETHERING_SERVICE)).thenReturn(mTetheringManager);
when(mTetheringManager.getTetherableWifiRegexs()).thenReturn(new String[]{"1", "2"}); when(mTetheringManager.getTetherableWifiRegexs()).thenReturn(new String[]{"1", "2"});
mController = new WifiTetherFooterPreferenceController(mContext); mController = new WifiTetherFooterPreferenceController(mContext);