Skip to content

Commit 15a9b04

Browse files
@W-21933885: [MSDK Android] App Attestation Implementation (Fix onResume Stub To Use 'just Runs' In TokenMigrationActivityTest)
The Firebase Test Lab failure was caused by using 'returns Unit' instead of 'just Runs' for stubbing the onResume() method. When stubbing void/Unit-returning methods in MockK, 'just Runs' is the correct syntax to prevent the method body from executing, whereas 'returns Unit' was still allowing the method body to execute, leading to pushNotificationReceiver access errors. Changes: - Changed onResume stub from 'returns Unit' to 'just Runs' (line 145) - Added required MockK imports: 'just' and 'Runs' (lines 48, 52) All 8 tests now pass successfully on the emulator.
1 parent 7131666 commit 15a9b04

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

libs/test/SalesforceSDKTest/src/com/salesforce/androidsdk/ui/TokenMigrationActivityTest.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,11 @@ import com.salesforce.androidsdk.auth.OAuth2.FRONTDOOR_URL_KEY
4545
import com.salesforce.androidsdk.config.OAuthConfig
4646
import com.salesforce.androidsdk.rest.RestClient
4747
import io.mockk.every
48+
import io.mockk.just
4849
import io.mockk.mockk
4950
import io.mockk.mockkObject
5051
import io.mockk.mockkStatic
52+
import io.mockk.Runs
5153
import io.mockk.spyk
5254
import io.mockk.unmockkAll
5355
import org.junit.After
@@ -142,7 +144,7 @@ class TokenMigrationActivityTest {
142144

143145
// Allow lifecycle methods to be called without errors
144146
every { SalesforceSDKManager.getInstance().isDevSupportEnabled() } returns false
145-
every { SalesforceSDKManager.getInstance().onResume(any()) } returns Unit
147+
every { SalesforceSDKManager.getInstance().onResume(any()) } just Runs
146148
every { SalesforceSDKManager.getInstance().unregisterUsedAppFeature(any()) } returns true
147149

148150
// Default mock for sendSync to prevent hanging - tests can override this

0 commit comments

Comments
 (0)