From e7f3bdb1ecc717966166c8397a0d49b6493ba637 Mon Sep 17 00:00:00 2001 From: Rebecca Silberstein Date: Wed, 22 Mar 2017 15:24:31 -0700 Subject: WifiStateMachineTest: update string matchers This CL fixes test failures introduced by the change for matchers in mockito. The test used anyString() where the test value was null. The test now sets the value and uses it in the matcher. Bug: 36407367 Test: frameworks/opt/net/wifi/tests/wifitests/runtests.sh -e class com.android.server.wifi.WifiStateMachineTest Change-Id: Iaae2db2766392fabd4458c2c376655a78eafde34 --- .../android/server/wifi/WifiStateMachineTest.java | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'tests') diff --git a/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java b/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java index 5755d9c4e..cc8535318 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java @@ -1288,14 +1288,15 @@ public class WifiStateMachineTest { mWsm.setOperationalMode(WifiStateMachine.CONNECT_MODE); mLooper.dispatchAll(); - when(mWifiNative.startWpsPbc(anyString())).thenReturn(true); + when(mWifiNative.startWpsPbc(eq(sBSSID))).thenReturn(true); WpsInfo wpsInfo = new WpsInfo(); wpsInfo.setup = WpsInfo.PBC; + wpsInfo.BSSID = sBSSID; mLooper.startAutoDispatch(); mWsm.sendMessage(WifiManager.START_WPS, 0, 0, wpsInfo); mLooper.stopAutoDispatch(); - verify(mWifiNative).startWpsPbc(anyString()); + verify(mWifiNative).startWpsPbc(eq(sBSSID)); assertEquals("WpsRunningState", getCurrentState().getName()); @@ -1317,14 +1318,15 @@ public class WifiStateMachineTest { mWsm.setOperationalMode(WifiStateMachine.CONNECT_MODE); mLooper.dispatchAll(); - when(mWifiNative.startWpsPbc(anyString())).thenReturn(false); + when(mWifiNative.startWpsPbc(eq(sBSSID))).thenReturn(false); WpsInfo wpsInfo = new WpsInfo(); wpsInfo.setup = WpsInfo.PBC; + wpsInfo.BSSID = sBSSID; mLooper.startAutoDispatch(); mWsm.sendMessage(WifiManager.START_WPS, 0, 0, wpsInfo); mLooper.stopAutoDispatch(); - verify(mWifiNative).startWpsPbc(anyString()); + verify(mWifiNative).startWpsPbc(eq(sBSSID)); assertFalse("WpsRunningState".equals(getCurrentState().getName())); } @@ -1338,14 +1340,15 @@ public class WifiStateMachineTest { mWsm.setOperationalMode(WifiStateMachine.CONNECT_MODE); mLooper.dispatchAll(); - when(mWifiNative.startWpsPinDisplay(anyString())).thenReturn("34545434"); + when(mWifiNative.startWpsPinDisplay(eq(sBSSID))).thenReturn("34545434"); WpsInfo wpsInfo = new WpsInfo(); wpsInfo.setup = WpsInfo.DISPLAY; + wpsInfo.BSSID = sBSSID; mLooper.startAutoDispatch(); mWsm.sendMessage(WifiManager.START_WPS, 0, 0, wpsInfo); mLooper.stopAutoDispatch(); - verify(mWifiNative).startWpsPinDisplay(anyString()); + verify(mWifiNative).startWpsPinDisplay(eq(sBSSID)); assertEquals("WpsRunningState", getCurrentState().getName()); @@ -1367,14 +1370,15 @@ public class WifiStateMachineTest { mWsm.setOperationalMode(WifiStateMachine.CONNECT_MODE); mLooper.dispatchAll(); - when(mWifiNative.startWpsPinDisplay(anyString())).thenReturn(null); + when(mWifiNative.startWpsPinDisplay(eq(sBSSID))).thenReturn(null); WpsInfo wpsInfo = new WpsInfo(); wpsInfo.setup = WpsInfo.DISPLAY; + wpsInfo.BSSID = sBSSID; mLooper.startAutoDispatch(); mWsm.sendMessage(WifiManager.START_WPS, 0, 0, wpsInfo); mLooper.stopAutoDispatch(); - verify(mWifiNative).startWpsPinDisplay(anyString()); + verify(mWifiNative).startWpsPinDisplay(eq(sBSSID)); assertFalse("WpsRunningState".equals(getCurrentState().getName())); } -- cgit v1.2.3