Cherry-pick some test changes from ag/13210542.

ag/13210542 switched from using reset() on mResources to using
clearInvocations(). This ensures that only the previous calls are
reset, and that the mock continues to behave according to what
was specified in setUp.

Test: 183097033
Test: test-only change
Merged-In: I35d28c8df341dbbac2774026c6ca749e296c0482
Change-Id: Ieef982d2df50db3014f35f58a77674939ebe0d43
This commit is contained in:
Lorenzo Colitti
2021-03-21 01:50:08 +09:00
parent c382ea55c5
commit 0f48c00d53

View File

@@ -20,6 +20,7 @@ import static com.android.server.connectivity.NetworkNotificationManager.Notific
import static org.mockito.Mockito.any; import static org.mockito.Mockito.any;
import static org.mockito.Mockito.anyInt; import static org.mockito.Mockito.anyInt;
import static org.mockito.Mockito.clearInvocations;
import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.eq; import static org.mockito.Mockito.eq;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
@@ -142,15 +143,15 @@ public class NetworkNotificationManagerTest {
public void testTitleOfPrivateDnsBroken() { public void testTitleOfPrivateDnsBroken() {
// Test the title of mobile data. // Test the title of mobile data.
verifyTitleByNetwork(100, mCellNai, R.string.mobile_no_internet); verifyTitleByNetwork(100, mCellNai, R.string.mobile_no_internet);
reset(mResources); clearInvocations(mResources);
// Test the title of wifi. // Test the title of wifi.
verifyTitleByNetwork(101, mWifiNai, R.string.wifi_no_internet); verifyTitleByNetwork(101, mWifiNai, R.string.wifi_no_internet);
reset(mResources); clearInvocations(mResources);
// Test the title of other networks. // Test the title of other networks.
verifyTitleByNetwork(102, mVpnNai, R.string.other_networks_no_internet); verifyTitleByNetwork(102, mVpnNai, R.string.other_networks_no_internet);
reset(mResources); clearInvocations(mResources);
} }
@Test @Test