From 2078ffdef94c81f7808b56b87e8087bead8a2e09 Mon Sep 17 00:00:00 2001 From: Sohani Rao Date: Mon, 27 Mar 2017 17:29:28 -0700 Subject: Make WifiStateTrackerTest work with Mockito2.0 Replace anyString() with any() in order to get the test passing Bug: 36659003 Test: Unit test for WifiStateTracker Change-Id: Id35bab32591a72df3de18b6d771971f8981029b2 --- .../src/com/android/server/wifi/WifiStateTrackerTest.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/wifitests/src/com/android/server/wifi/WifiStateTrackerTest.java b/tests/wifitests/src/com/android/server/wifi/WifiStateTrackerTest.java index 1f2af10ab..b6c8b8d5c 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiStateTrackerTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiStateTrackerTest.java @@ -18,8 +18,8 @@ package com.android.server.wifi; import com.android.internal.app.IBatteryStats; +import static org.mockito.Mockito.any; import static org.mockito.Mockito.anyInt; -import static org.mockito.Mockito.anyString; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; @@ -53,7 +53,6 @@ public class WifiStateTrackerTest { * Ensure BatteryStats's noteWifiState() is called when the method * updateState() is invoked on WifiStateTracker for relevant states. */ - @DisabledForUpdateToAnyMatcher @Test public void testBatteryStatsUpdated() throws Exception { int[] relevantStates = new int[] { WifiStateTracker.SCAN_MODE, @@ -62,7 +61,7 @@ public class WifiStateTrackerTest { for (int i = 0; i < relevantStates.length; i++) { mWifiStateTracker.updateState(relevantStates[i]); } - verify(mBatteryStats, times(relevantStates.length)).noteWifiState(anyInt(), anyString()); + verify(mBatteryStats, times(relevantStates.length)).noteWifiState(anyInt(), any()); } /** @@ -76,6 +75,6 @@ public class WifiStateTrackerTest { for (int i = 0; i < irrelevantStates.length; i++) { mWifiStateTracker.updateState(irrelevantStates[i]); } - verify(mBatteryStats, times(0)).noteWifiState(anyInt(), anyString()); + verify(mBatteryStats, times(0)).noteWifiState(anyInt(), any()); } } -- cgit v1.2.3