Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 800ccac4 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Finish mocking in finally clause" am: 6385740b am: 9620fa37

Change-Id: I7cd531d9e26313cea8b56e62e721e170001641dd
parents ccd579d9 9620fa37
Loading
Loading
Loading
Loading
+10 −8
Original line number Diff line number Diff line
@@ -95,15 +95,17 @@ class ModuleNetworkStackClientTest {
        // Force NetworkStack.getService() to return null: this cannot be done with
        // setServiceForTest, as passing null just restores default behavior.
        val session = mockitoSession().spyStatic(NetworkStack::class.java).startMocking()
        try {
            doReturn(null).`when` { NetworkStack.getService() }
            ModuleNetworkStackClient.getInstance(mContext).makeIpClient(TEST_IFNAME, mIpClientCb)

            Thread.sleep(TEST_TIMEOUT_MS)
            verify(mConnector, never()).makeIpClient(any(), any())
            NetworkStack.setServiceForTest(mConnectorBinder)

        } finally {
            // Restore behavior of NetworkStack to return what was set in setServiceForTest
            session.finishMocking()
        }

        // Use a longer timeout as polling can cause larger delays
        verify(mConnector, timeout(TEST_TIMEOUT_MS * 4)).makeIpClient(TEST_IFNAME, mIpClientCb)