@@ -118,15 +118,17 @@ class ConnectivityServiceTest {
118118 .thenReturn(true )
119119 whenever(
120120 networkCapabilities
121- .hasCapability(eq(NetworkCapabilities .NET_CAPABILITY_NOT_METERED )) // ← fixed
121+ .hasCapability(eq(NetworkCapabilities .NET_CAPABILITY_NOT_METERED ))
122122 )
123123 .thenReturn(true )
124124
125125 whenever(requestBuilder.invoke(any())).thenReturn(getRequest)
126126 whenever(clientFactory.createPlainClient()).thenReturn(client)
127127 whenever(user.server).thenReturn(newServer)
128128 whenever(accountManager.user).thenReturn(user)
129- whenever(walledCheckCache.getValue()).thenReturn(null )
129+
130+ val key = ConnectivityKey (user.accountName,newServer.uri.toString())
131+ whenever(walledCheckCache.getValue(key)).thenReturn(null )
130132
131133 connectivityService = ConnectivityServiceImpl (
132134 context,
@@ -226,7 +228,7 @@ class ConnectivityServiceTest {
226228 }
227229
228230 fun mockResponse (maintenance : Boolean = true, httpStatus : Int = HttpStatus .SC_OK ) {
229- whenever(getRequest.execute(client)).thenReturn(httpStatus) // ← fixed
231+ whenever(getRequest.execute(client)).thenReturn(httpStatus)
230232 val body =
231233 """ {"maintenance":$maintenance }"""
232234 whenever(getRequest.getResponseContentLength()).thenReturn(body.length.toLong())
@@ -289,7 +291,7 @@ class ConnectivityServiceTest {
289291 // network is connected to wifi, but metered
290292 whenever(
291293 networkCapabilities
292- .hasCapability(NetworkCapabilities .NET_CAPABILITY_NOT_METERED ) // ← fixed
294+ .hasCapability(NetworkCapabilities .NET_CAPABILITY_NOT_METERED )
293295 )
294296 .thenReturn(false )
295297 connectivityService.updateConnectivity()
0 commit comments