Migrate settings robolectric tests to mockito 2
- Migrated ArgumentMatcher subclasses to lambdas - Replaced any() with nullable() where tests were failing Test: cd tests/robotests && mma Bug: 38456058 Change-Id: Ice8c39b435c45b87f82dbbd9860e68f235314cf8
This commit is contained in:
@@ -17,6 +17,7 @@ package com.android.settings.wifi.details;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.nullable;
|
||||
import static org.mockito.Matchers.any;
|
||||
import static org.mockito.Mockito.doNothing;
|
||||
import static org.mockito.Mockito.inOrder;
|
||||
@@ -158,7 +159,7 @@ public class WifiDetailPreferenceControllerTest {
|
||||
when(mockConnectivityManager.getNetworkInfo(any(Network.class)))
|
||||
.thenReturn(mockNetworkInfo);
|
||||
doNothing().when(mockConnectivityManagerWrapper).registerNetworkCallback(
|
||||
any(NetworkRequest.class), mCallbackCaptor.capture(), any(Handler.class));
|
||||
nullable(NetworkRequest.class), mCallbackCaptor.capture(), nullable(Handler.class));
|
||||
doNothing().when(mockForgetButton).setOnClickListener(mForgetClickListener.capture());
|
||||
|
||||
when(mockWifiInfo.getLinkSpeed()).thenReturn(LINK_SPEED);
|
||||
@@ -254,7 +255,7 @@ public class WifiDetailPreferenceControllerTest {
|
||||
mController.onResume();
|
||||
|
||||
verify(mockConnectivityManagerWrapper, times(1)).registerNetworkCallback(
|
||||
any(NetworkRequest.class), mCallbackCaptor.capture(), any(Handler.class));
|
||||
nullable(NetworkRequest.class), mCallbackCaptor.capture(), nullable(Handler.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user