summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRebecca Silberstein <silberst@google.com>2017-03-22 15:24:31 -0700
committerRebecca Silberstein <silberst@google.com>2017-03-22 15:29:51 -0700
commite7f3bdb1ecc717966166c8397a0d49b6493ba637 (patch)
treeae0dac4ded69bbd1550dee52c8fc1e497a696465 /tests
parent168fba718720b54cf0a88cfad7f96948925fb1e3 (diff)
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
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java20
1 files changed, 12 insertions, 8 deletions
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()));
}