@@ -29,13 +29,16 @@ class CheckWifiTaskUnitTest : BaseUnitTest() {
2929 val bridge: AndroidDebugBridge = mock()
3030 val outputReceiver: CollectingOutputReceiver = mock()
3131 val outputReceiverProvider: OutputReceiverProvider = mock()
32- val defaultPluginTask: DefaultPluginTask = mock()
3332
3433 val deviceCommunicator = DeviceCommunicator (bridge, outputReceiverProvider)
35- val noDevices = emptyArray<IDevice >()
36- val wifi = " wifi"
34+ val wifi = " wlanName"
3735 val devices = arrayOf(device)
3836 val mNetworkInfo = " mNetworkInfo [type: WIFI[], extra: \" $wifi \" ]"
37+ val wifiDumpsysAndroid9 = " mWifiInfo SSID: $wifi , BSSID: 50:06:04:c2:f5:5d, MAC: a8:db:03:e0:e1:e5, Supplicant state: COMPLETED, RSSI: -62, Link speed: 270Mbps, Frequency: 5180MHz, Net ID: 2, Metered hint: false, GigaAp: false, VenueName: null, WifiMode: 4, score: 60\n " +
38+ " mDhcpResults IP address 172.30.13.47/20 Gateway 172.30.15.245 DNS servers: [ 194.25.0.52 8.8.8.8 8.8.4.4 ] Domains asv.cor DHCP server /10.10.54.54 Vendor info null lease 1800 seconds\n " +
39+ " mNetworkInfo [type: WIFI[], state: CONNECTED/CONNECTED, reason: (unspecified), extra: (none), failover: false, available: true, roaming: false]\n "
40+
41+
3942
4043 lateinit var projectDir: File
4144 lateinit var project: Project
@@ -53,31 +56,39 @@ class CheckWifiTaskUnitTest : BaseUnitTest() {
5356 task.wifi = wifi
5457
5558 given(outputReceiverProvider.get()).willReturn(outputReceiver)
59+ given(bridge.devices).willReturn(devices)
60+
5661 }
5762
5863 @Test(expected = GradleException ::class )
5964 fun `throw gradle exception when string in extension is empty` () {
6065 task.wifi = " "
61- given(bridge.devices).willReturn(devices)
6266
6367 task.runTask1()
6468 }
6569
6670 @Test(expected = GradleException ::class )
6771 fun `throw gradle exception when string in extension is blank` () {
6872 task.wifi = " "
69- given(bridge.devices).willReturn(devices)
7073
7174 task.runTask1()
7275 }
7376
7477 @Test
7578 fun `no gradle exception is thrown when connected to right wifi` () {
76- given(bridge.devices).willReturn(devices)
7779 given(outputReceiver.output).willReturn(mNetworkInfo)
7880
7981 task.runTask2(device)
8082
8183 thenDeviceShouldGetDetails(device)
8284 }
85+
86+ @Test
87+ fun `no gradle exception is thrown when connected to right wifi on Android 9 and 10` () {
88+ given(outputReceiver.output).willReturn(wifiDumpsysAndroid9)
89+
90+ task.runTask2(device)
91+
92+ thenDeviceShouldGetDetails(device)
93+ }
8394}
0 commit comments