From e7963a1d82f251d37250bd7d081857477f1af1ab Mon Sep 17 00:00:00 2001 From: Lorenzo Colitti Date: Sun, 21 Mar 2021 01:50:08 +0900 Subject: [PATCH] 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 --- .../connectivity/NetworkNotificationManagerTest.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/net/java/com/android/server/connectivity/NetworkNotificationManagerTest.java b/tests/net/java/com/android/server/connectivity/NetworkNotificationManagerTest.java index ff8c632833..2adde7400d 100644 --- a/tests/net/java/com/android/server/connectivity/NetworkNotificationManagerTest.java +++ b/tests/net/java/com/android/server/connectivity/NetworkNotificationManagerTest.java @@ -20,6 +20,7 @@ import static com.android.server.connectivity.NetworkNotificationManager.Notific import static org.mockito.Mockito.any; import static org.mockito.Mockito.anyInt; +import static org.mockito.Mockito.clearInvocations; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.eq; import static org.mockito.Mockito.mock; @@ -142,15 +143,15 @@ public class NetworkNotificationManagerTest { public void testTitleOfPrivateDnsBroken() { // Test the title of mobile data. verifyTitleByNetwork(100, mCellNai, R.string.mobile_no_internet); - reset(mResources); + clearInvocations(mResources); // Test the title of wifi. verifyTitleByNetwork(101, mWifiNai, R.string.wifi_no_internet); - reset(mResources); + clearInvocations(mResources); // Test the title of other networks. verifyTitleByNetwork(102, mVpnNai, R.string.other_networks_no_internet); - reset(mResources); + clearInvocations(mResources); } @Test