Skip to content

Commit 55a9ec5

Browse files
author
Paulina Strychacz
committed
addressed code review comments
1 parent 295d12f commit 55a9ec5

File tree

2 files changed

+126
-126
lines changed

2 files changed

+126
-126
lines changed

src/test/kotlin/unitTest/tasks/CheckWifiTaskUnitTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ class CheckWifiTaskUnitTest : BaseUnitTest() {
3434
val wifi = "wlanName"
3535
val devices = arrayOf(device)
3636
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" +
37+
val wifiDumpsysAndroid9 = "mWifiInfo SSID: $wifi, BSSID: 50:06:04:50:06:04, MAC: a8:db:03:a8:db:03, 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 xxx.xx.xx.xx/20 Gateway xxx.xx.xx.xx DNS servers: [ xxx.xx.xx.xx 8.8.8.8 8.8.4.4 ] Domains asv.cor DHCP server /xxx.xx.xx.xx Vendor info null lease 1800 seconds\n" +
3939
"mNetworkInfo [type: WIFI[], state: CONNECTED/CONNECTED, reason: (unspecified), extra: (none), failover: false, available: true, roaming: false]\n"
4040

4141

src/test/kotlin/unitTest/tasks/internal/UnlockerTest.kt

Lines changed: 124 additions & 124 deletions
Original file line numberDiff line numberDiff line change
@@ -51,19 +51,19 @@ class UnlockerTest {
5151
given(outputReceiverProvider.get()).willReturn(outputReceiver)
5252
}
5353

54-
// @Test
55-
// fun `nothing is done when power button is chosen`() {
56-
// val classToTest = Unlocker(
57-
// deviceWrapper,
58-
// POWER_BUTTON.string,
59-
// pin,
60-
// password
61-
// )
62-
//
63-
// classToTest.unlock()
64-
//
65-
// then(device).should(never()).executeShellCommand(any(), any())
66-
// }
54+
@Test
55+
fun `nothing is done when power button is chosen`() {
56+
val classToTest = Unlocker(
57+
deviceWrapper,
58+
POWER_BUTTON.string,
59+
pin,
60+
password
61+
)
62+
63+
classToTest.unlock()
64+
65+
then(device).should(never()).executeShellCommand(any(), any())
66+
}
6767

6868
@Test
6969
fun `device can be unlocked by swipe`() {
@@ -93,122 +93,122 @@ class UnlockerTest {
9393
classToTestSwipe.unlock()
9494
}
9595

96-
// @Test(expected = GradleException::class)
97-
// fun `gradle exception is thrown when pin is blank`() {
98-
// val classToTest = Unlocker(
99-
// deviceWrapper,
100-
// PIN.string,
101-
// emptyString,
102-
// password
103-
// )
104-
//
105-
// classToTest.unlock()
106-
// }
107-
108-
// @Test(expected = GradleException::class)
109-
// fun `gradle exception is thrown when pin has less than 4 digits`() {
110-
// val classToTest = Unlocker(
111-
// deviceWrapper,
112-
// PIN.string,
113-
// wrongPin1,
114-
// password
115-
// )
116-
//
117-
// classToTest.unlock()
118-
// }
119-
//
120-
// @Test(expected = GradleException::class)
121-
// fun `gradle exception is thrown when pin is not only numbers`() {
122-
// val classToTest = Unlocker(
123-
// deviceWrapper,
124-
// PIN.string,
125-
// wrongPin2,
126-
// password
127-
// )
128-
//
129-
// classToTest.unlock()
130-
// }
131-
//
132-
// @Test
133-
// fun `device can be unlocked by pin`() {
134-
// val classToTest = Unlocker(
135-
// deviceWrapper,
136-
// PIN.string,
137-
// pin,
138-
// password
139-
// )
140-
//
141-
// given(outputReceiver.output).willReturn(output)
142-
//
143-
// classToTest.unlock()
144-
//
145-
// thenPassPhraseShouldBeEntered(device, pin)
146-
// }
96+
@Test(expected = GradleException::class)
97+
fun `gradle exception is thrown when pin is blank`() {
98+
val classToTest = Unlocker(
99+
deviceWrapper,
100+
PIN.string,
101+
emptyString,
102+
password
103+
)
104+
105+
classToTest.unlock()
106+
}
107+
108+
@Test(expected = GradleException::class)
109+
fun `gradle exception is thrown when pin has less than 4 digits`() {
110+
val classToTest = Unlocker(
111+
deviceWrapper,
112+
PIN.string,
113+
wrongPin1,
114+
password
115+
)
116+
117+
classToTest.unlock()
118+
}
119+
120+
@Test(expected = GradleException::class)
121+
fun `gradle exception is thrown when pin is not only numbers`() {
122+
val classToTest = Unlocker(
123+
deviceWrapper,
124+
PIN.string,
125+
wrongPin2,
126+
password
127+
)
128+
129+
classToTest.unlock()
130+
}
131+
132+
@Test
133+
fun `device can be unlocked by pin`() {
134+
val classToTest = Unlocker(
135+
deviceWrapper,
136+
PIN.string,
137+
pin,
138+
password
139+
)
140+
141+
given(outputReceiver.output).willReturn(output)
142+
143+
classToTest.unlock()
144+
145+
thenPassPhraseShouldBeEntered(device, pin)
146+
}
147147

148148
private fun thenPassPhraseShouldBeEntered(device: IDevice, passPhrase: String){
149149
then(device).should(Times(2)).executeShellCommand(eq(DUMPSYS_WINDOW), any())
150150
then(device).should().executeShellCommand(eq("input swipe 50 160 80 40"), any())
151151
then(device).should().executeShellCommand(eq("$INPUT_TEXT $passPhrase"), any())
152152
then(device).should().executeShellCommand(eq(INPUT_PRESS_ENTER), any())
153153
}
154-
//
155-
// @Test(expected = GradleException::class)
156-
// fun `gradle exception is thrown when password is blank`() {
157-
// val classToTest = Unlocker(
158-
// deviceWrapper,
159-
// PASSWORD.string,
160-
// pin,
161-
// wrongPassword1
162-
// )
163-
//
164-
// given(outputReceiver.output).willReturn(output)
165-
//
166-
// classToTest.unlock()
167-
// }
168-
//
169-
// @Test(expected = GradleException::class)
170-
// fun `gradle exception is thrown when password is empty`() {
171-
// val classToTest = Unlocker(
172-
// deviceWrapper,
173-
// PASSWORD.string,
174-
// pin,
175-
// wrongPassword2
176-
// )
177-
//
178-
// given(outputReceiver.output).willReturn(output)
179-
//
180-
// classToTest.unlock()
181-
// }
182-
//
183-
//
184-
// @Test
185-
// fun `device can be unlocked by password`() {
186-
// val classToTest = Unlocker(
187-
// deviceWrapper,
188-
// PASSWORD.string,
189-
// pin,
190-
// password
191-
// )
192-
//
193-
// given(outputReceiver.output).willReturn(output)
194-
//
195-
// classToTest.unlock()
196-
//
197-
//
198-
// thenPassPhraseShouldBeEntered(device, password)
199-
// }
200-
//
201-
// @Test(expected = GradleException::class)
202-
// fun `gradle exception is thrown when wrong unlock method is chosen`() {
203-
// val classToTest = Unlocker(
204-
// deviceWrapper,
205-
// wrongMethod,
206-
// pin,
207-
// password
208-
// )
209-
//
210-
// given(outputReceiver.output).willReturn(output)
211-
//
212-
// classToTest.unlock()
213-
// }
154+
155+
@Test(expected = GradleException::class)
156+
fun `gradle exception is thrown when password is blank`() {
157+
val classToTest = Unlocker(
158+
deviceWrapper,
159+
PASSWORD.string,
160+
pin,
161+
wrongPassword1
162+
)
163+
164+
given(outputReceiver.output).willReturn(output)
165+
166+
classToTest.unlock()
167+
}
168+
169+
@Test(expected = GradleException::class)
170+
fun `gradle exception is thrown when password is empty`() {
171+
val classToTest = Unlocker(
172+
deviceWrapper,
173+
PASSWORD.string,
174+
pin,
175+
wrongPassword2
176+
)
177+
178+
given(outputReceiver.output).willReturn(output)
179+
180+
classToTest.unlock()
181+
}
182+
183+
184+
@Test
185+
fun `device can be unlocked by password`() {
186+
val classToTest = Unlocker(
187+
deviceWrapper,
188+
PASSWORD.string,
189+
pin,
190+
password
191+
)
192+
193+
given(outputReceiver.output).willReturn(output)
194+
195+
classToTest.unlock()
196+
197+
198+
thenPassPhraseShouldBeEntered(device, password)
199+
}
200+
201+
@Test(expected = GradleException::class)
202+
fun `gradle exception is thrown when wrong unlock method is chosen`() {
203+
val classToTest = Unlocker(
204+
deviceWrapper,
205+
wrongMethod,
206+
pin,
207+
password
208+
)
209+
210+
given(outputReceiver.output).willReturn(output)
211+
212+
classToTest.unlock()
213+
}
214214
}

0 commit comments

Comments
 (0)