From 05542932e8a25a03884681e64380df605db180b8 Mon Sep 17 00:00:00 2001 From: Maddie Beyl Date: Wed, 5 Jan 2022 15:21:14 -0800 Subject: [PATCH 1/6] Add log when activity intent is null --- .../java/com/revenuecat/purchases/google/BillingWrapper.kt | 3 +++ .../java/com/revenuecat/purchases/strings/BillingStrings.kt | 2 ++ 2 files changed, 5 insertions(+) diff --git a/feature/google/src/main/java/com/revenuecat/purchases/google/BillingWrapper.kt b/feature/google/src/main/java/com/revenuecat/purchases/google/BillingWrapper.kt index 6f56608b2d..418d21f63a 100644 --- a/feature/google/src/main/java/com/revenuecat/purchases/google/BillingWrapper.kt +++ b/feature/google/src/main/java/com/revenuecat/purchases/google/BillingWrapper.kt @@ -222,6 +222,9 @@ class BillingWrapper( activity: Activity, params: BillingFlowParams ) { + if (activity.intent == null) { + log(LogIntent.WARNING, BillingStrings.NULL_ACTIVITY_INTENT) + } withConnectedClient { launchBillingFlow(activity, params) .takeIf { billingResult -> billingResult.responseCode != BillingClient.BillingResponseCode.OK } diff --git a/strings/src/main/java/com/revenuecat/purchases/strings/BillingStrings.kt b/strings/src/main/java/com/revenuecat/purchases/strings/BillingStrings.kt index 8aa1587f80..0d0403729a 100644 --- a/strings/src/main/java/com/revenuecat/purchases/strings/BillingStrings.kt +++ b/strings/src/main/java/com/revenuecat/purchases/strings/BillingStrings.kt @@ -15,4 +15,6 @@ object BillingStrings { "PurchaseHistoryRecord, but only one will be used." const val BILLING_PURCHASE_MORE_THAN_ONE_SKU = "There's more than one sku in the PurchaseHistoryRecord, " + "but only one will be used." + const val NULL_ACTIVITY_INTENT = "Activity passed into launchBillingFlow has a null intent, which may cause " + + "a crash. See https://github.com/RevenueCat/purchases-android/issues/381 for more information." } From 47ba7a4193c3dd72663aad5c0396ddd5a2f08f4d Mon Sep 17 00:00:00 2001 From: Maddie Beyl Date: Wed, 5 Jan 2022 18:48:57 -0800 Subject: [PATCH 2/6] Add test, send new intent --- .../purchases/google/BillingWrapper.kt | 2 ++ .../purchases/google/BillingWrapperTest.kt | 33 +++++++++++++++++++ .../purchases/strings/BillingStrings.kt | 5 +-- 3 files changed, 38 insertions(+), 2 deletions(-) diff --git a/feature/google/src/main/java/com/revenuecat/purchases/google/BillingWrapper.kt b/feature/google/src/main/java/com/revenuecat/purchases/google/BillingWrapper.kt index 418d21f63a..d4eedaaded 100644 --- a/feature/google/src/main/java/com/revenuecat/purchases/google/BillingWrapper.kt +++ b/feature/google/src/main/java/com/revenuecat/purchases/google/BillingWrapper.kt @@ -7,6 +7,7 @@ package com.revenuecat.purchases.google import android.app.Activity import android.content.Context +import android.content.Intent import android.os.Handler import androidx.annotation.UiThread import com.android.billingclient.api.AcknowledgePurchaseParams @@ -223,6 +224,7 @@ class BillingWrapper( params: BillingFlowParams ) { if (activity.intent == null) { + activity.intent = Intent() log(LogIntent.WARNING, BillingStrings.NULL_ACTIVITY_INTENT) } withConnectedClient { diff --git a/feature/google/src/test/java/com/revenuecat/purchases/google/BillingWrapperTest.kt b/feature/google/src/test/java/com/revenuecat/purchases/google/BillingWrapperTest.kt index 65a48a9a90..2e4032d38c 100644 --- a/feature/google/src/test/java/com/revenuecat/purchases/google/BillingWrapperTest.kt +++ b/feature/google/src/test/java/com/revenuecat/purchases/google/BillingWrapperTest.kt @@ -1642,6 +1642,39 @@ class BillingWrapperTest { assertThat(numCallbacks).isEqualTo(1) } + @Test + fun `test BillingClients launchBillingFlow activity never has null intent`() { + val slot = slot() + + mockkStatic(BillingFlowParams::class) + val mockBuilder = mockk(relaxed = true) + every { + BillingFlowParams.newBuilder() + } returns mockBuilder + + every { + mockBuilder.setSkuDetails(any()) + } returns mockBuilder + + val params = mockk(relaxed = true) + every { + mockBuilder.build() + } returns params + + every { + mockClient.launchBillingFlow(capture(slot), params) + } returns billingClientOKResult + + val activityWithNullIntent = Activity().apply { intent = null } + wrapper.makePurchaseAsync(activityWithNullIntent, + "", + stubSkuDetails(productId = "product_a").toStoreProduct(), + null, + null) + + assertThat(slot.captured.intent != null) + } + private fun mockNullSkuDetailsResponse() { val slot = slot() every { diff --git a/strings/src/main/java/com/revenuecat/purchases/strings/BillingStrings.kt b/strings/src/main/java/com/revenuecat/purchases/strings/BillingStrings.kt index 0d0403729a..8a36f9e979 100644 --- a/strings/src/main/java/com/revenuecat/purchases/strings/BillingStrings.kt +++ b/strings/src/main/java/com/revenuecat/purchases/strings/BillingStrings.kt @@ -15,6 +15,7 @@ object BillingStrings { "PurchaseHistoryRecord, but only one will be used." const val BILLING_PURCHASE_MORE_THAN_ONE_SKU = "There's more than one sku in the PurchaseHistoryRecord, " + "but only one will be used." - const val NULL_ACTIVITY_INTENT = "Activity passed into launchBillingFlow has a null intent, which may cause " + - "a crash. See https://github.com/RevenueCat/purchases-android/issues/381 for more information." + const val NULL_ACTIVITY_INTENT = "Activity passed into launchBillingFlow has a null intent. Setting a new " + + " intent to avoid crashing. See https://github.com/RevenueCat/purchases-android/issues/381 " + + "for more information." } From f7eb8ed908cee35d0d9539f3d6108abd73bb82a1 Mon Sep 17 00:00:00 2001 From: Maddie Beyl Date: Wed, 5 Jan 2022 19:53:01 -0800 Subject: [PATCH 3/6] Fix tests - set mock activity to return intent --- .../purchases/google/BillingWrapperTest.kt | 36 +++++++++---------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/feature/google/src/test/java/com/revenuecat/purchases/google/BillingWrapperTest.kt b/feature/google/src/test/java/com/revenuecat/purchases/google/BillingWrapperTest.kt index 2e4032d38c..354f8714e5 100644 --- a/feature/google/src/test/java/com/revenuecat/purchases/google/BillingWrapperTest.kt +++ b/feature/google/src/test/java/com/revenuecat/purchases/google/BillingWrapperTest.kt @@ -2,6 +2,7 @@ package com.revenuecat.purchases.google import android.app.Activity import android.content.Context +import android.content.Intent import android.os.Handler import androidx.test.ext.junit.runners.AndroidJUnit4 import com.android.billingclient.api.AcknowledgePurchaseParams @@ -80,6 +81,7 @@ class BillingWrapperTest { private val billingClientOKResult = BillingClient.BillingResponseCode.OK.buildResult() private val appUserId = "jerry" + private var mockActivity = mockk() @Before fun setup() { @@ -145,6 +147,10 @@ class BillingWrapperTest { onConnectedCalled = true } } + + every { + mockActivity.intent + } returns Intent() } @Test @@ -252,11 +258,9 @@ class BillingWrapperTest { val skuDetails = stubSkuDetails(productId = "product_a") - val activity: Activity = mockk() - billingClientStateListener!!.onBillingSetupFinished(BillingClient.BillingResponseCode.OK.buildResult()) wrapper.makePurchaseAsync( - activity, + mockActivity, appUserId, skuDetails.toStoreProduct(), mockReplaceSkuInfo(), @@ -265,7 +269,7 @@ class BillingWrapperTest { verify { mockClient.launchBillingFlow( - eq(activity), + eq(mockActivity), any() ) } @@ -305,12 +309,11 @@ class BillingWrapperTest { @BillingClient.SkuType val skuType = BillingClient.SkuType.SUBS val upgradeInfo = mockReplaceSkuInfo() - val activity: Activity = mockk() val skuDetails = stubSkuDetails(productId = sku, type = skuType) val slot = slot() every { - mockClient.launchBillingFlow(eq(activity), capture(slot)) + mockClient.launchBillingFlow(eq(mockActivity), capture(slot)) } answers { val capturedSkuDetails = skuDetailsSlot.captured @@ -324,7 +327,7 @@ class BillingWrapperTest { billingClientStateListener!!.onBillingSetupFinished(BillingClient.BillingResponseCode.OK.buildResult()) wrapper.makePurchaseAsync( - activity, + mockActivity, appUserId, skuDetails.toStoreProduct(), upgradeInfo, @@ -337,7 +340,7 @@ class BillingWrapperTest { val mockBuilder = setUpForObfuscatedAccountIDTests() wrapper.makePurchaseAsync( - mockk(), + mockActivity, appUserId, stubSkuDetails(productId = "product_a").toStoreProduct(), null, @@ -357,7 +360,7 @@ class BillingWrapperTest { val mockBuilder = setUpForObfuscatedAccountIDTests() wrapper.makePurchaseAsync( - mockk(), + mockActivity, appUserId, stubSkuDetails(productId = "product_a").toStoreProduct(), mockReplaceSkuInfo(), @@ -379,11 +382,10 @@ class BillingWrapperTest { every { mockClient.isReady } returns false - val activity: Activity = mockk() val skuDetails = stubSkuDetails(productId = "product_a") wrapper.makePurchaseAsync( - activity, + mockActivity, appUserId, skuDetails.toStoreProduct(), mockReplaceSkuInfo(), @@ -391,7 +393,7 @@ class BillingWrapperTest { ) verify(exactly = 0) { - mockClient.launchBillingFlow(eq(activity), any()) + mockClient.launchBillingFlow(eq(mockActivity), any()) } every { mockClient.isReady } returns true @@ -399,7 +401,7 @@ class BillingWrapperTest { billingClientStateListener!!.onBillingSetupFinished(BillingClient.BillingResponseCode.OK.buildResult()) verify(exactly = 1) { - mockClient.launchBillingFlow(eq(activity), any()) + mockClient.launchBillingFlow(eq(mockActivity), any()) } } @@ -413,10 +415,8 @@ class BillingWrapperTest { val skuDetails = stubSkuDetails(productId = "product_a") - val activity: Activity = mockk() - wrapper.makePurchaseAsync( - activity, + mockActivity, appUserId, skuDetails.toStoreProduct(), mockReplaceSkuInfo(), @@ -809,11 +809,9 @@ class BillingWrapperTest { val skuDetails = stubSkuDetails(productId = "product_a") - val activity: Activity = mockk() - billingClientStateListener!!.onBillingSetupFinished(BillingClient.BillingResponseCode.OK.buildResult()) wrapper.makePurchaseAsync( - activity, + mockActivity, appUserId, skuDetails.toStoreProduct(), mockReplaceSkuInfo(), From 2a6b5e906c2343a1c711f890436c659ff46f83da Mon Sep 17 00:00:00 2001 From: Maddie Beyl Date: Fri, 7 Jan 2022 14:57:50 -0800 Subject: [PATCH 4/6] Revert "Add test, send new intent" This reverts commit 3fe66dcc2de9424a520a73ad5030e3d6cb55a280. --- .../purchases/google/BillingWrapper.kt | 2 -- .../purchases/google/BillingWrapperTest.kt | 33 ------------------- .../purchases/strings/BillingStrings.kt | 5 ++- 3 files changed, 2 insertions(+), 38 deletions(-) diff --git a/feature/google/src/main/java/com/revenuecat/purchases/google/BillingWrapper.kt b/feature/google/src/main/java/com/revenuecat/purchases/google/BillingWrapper.kt index d4eedaaded..418d21f63a 100644 --- a/feature/google/src/main/java/com/revenuecat/purchases/google/BillingWrapper.kt +++ b/feature/google/src/main/java/com/revenuecat/purchases/google/BillingWrapper.kt @@ -7,7 +7,6 @@ package com.revenuecat.purchases.google import android.app.Activity import android.content.Context -import android.content.Intent import android.os.Handler import androidx.annotation.UiThread import com.android.billingclient.api.AcknowledgePurchaseParams @@ -224,7 +223,6 @@ class BillingWrapper( params: BillingFlowParams ) { if (activity.intent == null) { - activity.intent = Intent() log(LogIntent.WARNING, BillingStrings.NULL_ACTIVITY_INTENT) } withConnectedClient { diff --git a/feature/google/src/test/java/com/revenuecat/purchases/google/BillingWrapperTest.kt b/feature/google/src/test/java/com/revenuecat/purchases/google/BillingWrapperTest.kt index 354f8714e5..7e9005a0f2 100644 --- a/feature/google/src/test/java/com/revenuecat/purchases/google/BillingWrapperTest.kt +++ b/feature/google/src/test/java/com/revenuecat/purchases/google/BillingWrapperTest.kt @@ -1640,39 +1640,6 @@ class BillingWrapperTest { assertThat(numCallbacks).isEqualTo(1) } - @Test - fun `test BillingClients launchBillingFlow activity never has null intent`() { - val slot = slot() - - mockkStatic(BillingFlowParams::class) - val mockBuilder = mockk(relaxed = true) - every { - BillingFlowParams.newBuilder() - } returns mockBuilder - - every { - mockBuilder.setSkuDetails(any()) - } returns mockBuilder - - val params = mockk(relaxed = true) - every { - mockBuilder.build() - } returns params - - every { - mockClient.launchBillingFlow(capture(slot), params) - } returns billingClientOKResult - - val activityWithNullIntent = Activity().apply { intent = null } - wrapper.makePurchaseAsync(activityWithNullIntent, - "", - stubSkuDetails(productId = "product_a").toStoreProduct(), - null, - null) - - assertThat(slot.captured.intent != null) - } - private fun mockNullSkuDetailsResponse() { val slot = slot() every { diff --git a/strings/src/main/java/com/revenuecat/purchases/strings/BillingStrings.kt b/strings/src/main/java/com/revenuecat/purchases/strings/BillingStrings.kt index 8a36f9e979..0d0403729a 100644 --- a/strings/src/main/java/com/revenuecat/purchases/strings/BillingStrings.kt +++ b/strings/src/main/java/com/revenuecat/purchases/strings/BillingStrings.kt @@ -15,7 +15,6 @@ object BillingStrings { "PurchaseHistoryRecord, but only one will be used." const val BILLING_PURCHASE_MORE_THAN_ONE_SKU = "There's more than one sku in the PurchaseHistoryRecord, " + "but only one will be used." - const val NULL_ACTIVITY_INTENT = "Activity passed into launchBillingFlow has a null intent. Setting a new " + - " intent to avoid crashing. See https://github.com/RevenueCat/purchases-android/issues/381 " + - "for more information." + const val NULL_ACTIVITY_INTENT = "Activity passed into launchBillingFlow has a null intent, which may cause " + + "a crash. See https://github.com/RevenueCat/purchases-android/issues/381 for more information." } From cd397708bf41691a016a2771301b02bba4a80450 Mon Sep 17 00:00:00 2001 From: Maddie Beyl Date: Fri, 7 Jan 2022 14:59:21 -0800 Subject: [PATCH 5/6] Revert "Fix tests - set mock activity to return intent" This reverts commit 3f67c256b94659ed18555fd1d8a441408fbb210e. --- .../purchases/google/BillingWrapperTest.kt | 36 ++++++++++--------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/feature/google/src/test/java/com/revenuecat/purchases/google/BillingWrapperTest.kt b/feature/google/src/test/java/com/revenuecat/purchases/google/BillingWrapperTest.kt index 7e9005a0f2..65a48a9a90 100644 --- a/feature/google/src/test/java/com/revenuecat/purchases/google/BillingWrapperTest.kt +++ b/feature/google/src/test/java/com/revenuecat/purchases/google/BillingWrapperTest.kt @@ -2,7 +2,6 @@ package com.revenuecat.purchases.google import android.app.Activity import android.content.Context -import android.content.Intent import android.os.Handler import androidx.test.ext.junit.runners.AndroidJUnit4 import com.android.billingclient.api.AcknowledgePurchaseParams @@ -81,7 +80,6 @@ class BillingWrapperTest { private val billingClientOKResult = BillingClient.BillingResponseCode.OK.buildResult() private val appUserId = "jerry" - private var mockActivity = mockk() @Before fun setup() { @@ -147,10 +145,6 @@ class BillingWrapperTest { onConnectedCalled = true } } - - every { - mockActivity.intent - } returns Intent() } @Test @@ -258,9 +252,11 @@ class BillingWrapperTest { val skuDetails = stubSkuDetails(productId = "product_a") + val activity: Activity = mockk() + billingClientStateListener!!.onBillingSetupFinished(BillingClient.BillingResponseCode.OK.buildResult()) wrapper.makePurchaseAsync( - mockActivity, + activity, appUserId, skuDetails.toStoreProduct(), mockReplaceSkuInfo(), @@ -269,7 +265,7 @@ class BillingWrapperTest { verify { mockClient.launchBillingFlow( - eq(mockActivity), + eq(activity), any() ) } @@ -309,11 +305,12 @@ class BillingWrapperTest { @BillingClient.SkuType val skuType = BillingClient.SkuType.SUBS val upgradeInfo = mockReplaceSkuInfo() + val activity: Activity = mockk() val skuDetails = stubSkuDetails(productId = sku, type = skuType) val slot = slot() every { - mockClient.launchBillingFlow(eq(mockActivity), capture(slot)) + mockClient.launchBillingFlow(eq(activity), capture(slot)) } answers { val capturedSkuDetails = skuDetailsSlot.captured @@ -327,7 +324,7 @@ class BillingWrapperTest { billingClientStateListener!!.onBillingSetupFinished(BillingClient.BillingResponseCode.OK.buildResult()) wrapper.makePurchaseAsync( - mockActivity, + activity, appUserId, skuDetails.toStoreProduct(), upgradeInfo, @@ -340,7 +337,7 @@ class BillingWrapperTest { val mockBuilder = setUpForObfuscatedAccountIDTests() wrapper.makePurchaseAsync( - mockActivity, + mockk(), appUserId, stubSkuDetails(productId = "product_a").toStoreProduct(), null, @@ -360,7 +357,7 @@ class BillingWrapperTest { val mockBuilder = setUpForObfuscatedAccountIDTests() wrapper.makePurchaseAsync( - mockActivity, + mockk(), appUserId, stubSkuDetails(productId = "product_a").toStoreProduct(), mockReplaceSkuInfo(), @@ -382,10 +379,11 @@ class BillingWrapperTest { every { mockClient.isReady } returns false + val activity: Activity = mockk() val skuDetails = stubSkuDetails(productId = "product_a") wrapper.makePurchaseAsync( - mockActivity, + activity, appUserId, skuDetails.toStoreProduct(), mockReplaceSkuInfo(), @@ -393,7 +391,7 @@ class BillingWrapperTest { ) verify(exactly = 0) { - mockClient.launchBillingFlow(eq(mockActivity), any()) + mockClient.launchBillingFlow(eq(activity), any()) } every { mockClient.isReady } returns true @@ -401,7 +399,7 @@ class BillingWrapperTest { billingClientStateListener!!.onBillingSetupFinished(BillingClient.BillingResponseCode.OK.buildResult()) verify(exactly = 1) { - mockClient.launchBillingFlow(eq(mockActivity), any()) + mockClient.launchBillingFlow(eq(activity), any()) } } @@ -415,8 +413,10 @@ class BillingWrapperTest { val skuDetails = stubSkuDetails(productId = "product_a") + val activity: Activity = mockk() + wrapper.makePurchaseAsync( - mockActivity, + activity, appUserId, skuDetails.toStoreProduct(), mockReplaceSkuInfo(), @@ -809,9 +809,11 @@ class BillingWrapperTest { val skuDetails = stubSkuDetails(productId = "product_a") + val activity: Activity = mockk() + billingClientStateListener!!.onBillingSetupFinished(BillingClient.BillingResponseCode.OK.buildResult()) wrapper.makePurchaseAsync( - mockActivity, + activity, appUserId, skuDetails.toStoreProduct(), mockReplaceSkuInfo(), From 66ce79eb905c869ecd6923fc054dc7d609af74e0 Mon Sep 17 00:00:00 2001 From: Maddie Beyl Date: Mon, 10 Jan 2022 19:11:39 -0800 Subject: [PATCH 6/6] Revert "Revert "Fix tests - set mock activity to return intent"" This reverts commit cd397708bf41691a016a2771301b02bba4a80450. --- .../purchases/google/BillingWrapperTest.kt | 36 +++++++++---------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/feature/google/src/test/java/com/revenuecat/purchases/google/BillingWrapperTest.kt b/feature/google/src/test/java/com/revenuecat/purchases/google/BillingWrapperTest.kt index 65a48a9a90..7e9005a0f2 100644 --- a/feature/google/src/test/java/com/revenuecat/purchases/google/BillingWrapperTest.kt +++ b/feature/google/src/test/java/com/revenuecat/purchases/google/BillingWrapperTest.kt @@ -2,6 +2,7 @@ package com.revenuecat.purchases.google import android.app.Activity import android.content.Context +import android.content.Intent import android.os.Handler import androidx.test.ext.junit.runners.AndroidJUnit4 import com.android.billingclient.api.AcknowledgePurchaseParams @@ -80,6 +81,7 @@ class BillingWrapperTest { private val billingClientOKResult = BillingClient.BillingResponseCode.OK.buildResult() private val appUserId = "jerry" + private var mockActivity = mockk() @Before fun setup() { @@ -145,6 +147,10 @@ class BillingWrapperTest { onConnectedCalled = true } } + + every { + mockActivity.intent + } returns Intent() } @Test @@ -252,11 +258,9 @@ class BillingWrapperTest { val skuDetails = stubSkuDetails(productId = "product_a") - val activity: Activity = mockk() - billingClientStateListener!!.onBillingSetupFinished(BillingClient.BillingResponseCode.OK.buildResult()) wrapper.makePurchaseAsync( - activity, + mockActivity, appUserId, skuDetails.toStoreProduct(), mockReplaceSkuInfo(), @@ -265,7 +269,7 @@ class BillingWrapperTest { verify { mockClient.launchBillingFlow( - eq(activity), + eq(mockActivity), any() ) } @@ -305,12 +309,11 @@ class BillingWrapperTest { @BillingClient.SkuType val skuType = BillingClient.SkuType.SUBS val upgradeInfo = mockReplaceSkuInfo() - val activity: Activity = mockk() val skuDetails = stubSkuDetails(productId = sku, type = skuType) val slot = slot() every { - mockClient.launchBillingFlow(eq(activity), capture(slot)) + mockClient.launchBillingFlow(eq(mockActivity), capture(slot)) } answers { val capturedSkuDetails = skuDetailsSlot.captured @@ -324,7 +327,7 @@ class BillingWrapperTest { billingClientStateListener!!.onBillingSetupFinished(BillingClient.BillingResponseCode.OK.buildResult()) wrapper.makePurchaseAsync( - activity, + mockActivity, appUserId, skuDetails.toStoreProduct(), upgradeInfo, @@ -337,7 +340,7 @@ class BillingWrapperTest { val mockBuilder = setUpForObfuscatedAccountIDTests() wrapper.makePurchaseAsync( - mockk(), + mockActivity, appUserId, stubSkuDetails(productId = "product_a").toStoreProduct(), null, @@ -357,7 +360,7 @@ class BillingWrapperTest { val mockBuilder = setUpForObfuscatedAccountIDTests() wrapper.makePurchaseAsync( - mockk(), + mockActivity, appUserId, stubSkuDetails(productId = "product_a").toStoreProduct(), mockReplaceSkuInfo(), @@ -379,11 +382,10 @@ class BillingWrapperTest { every { mockClient.isReady } returns false - val activity: Activity = mockk() val skuDetails = stubSkuDetails(productId = "product_a") wrapper.makePurchaseAsync( - activity, + mockActivity, appUserId, skuDetails.toStoreProduct(), mockReplaceSkuInfo(), @@ -391,7 +393,7 @@ class BillingWrapperTest { ) verify(exactly = 0) { - mockClient.launchBillingFlow(eq(activity), any()) + mockClient.launchBillingFlow(eq(mockActivity), any()) } every { mockClient.isReady } returns true @@ -399,7 +401,7 @@ class BillingWrapperTest { billingClientStateListener!!.onBillingSetupFinished(BillingClient.BillingResponseCode.OK.buildResult()) verify(exactly = 1) { - mockClient.launchBillingFlow(eq(activity), any()) + mockClient.launchBillingFlow(eq(mockActivity), any()) } } @@ -413,10 +415,8 @@ class BillingWrapperTest { val skuDetails = stubSkuDetails(productId = "product_a") - val activity: Activity = mockk() - wrapper.makePurchaseAsync( - activity, + mockActivity, appUserId, skuDetails.toStoreProduct(), mockReplaceSkuInfo(), @@ -809,11 +809,9 @@ class BillingWrapperTest { val skuDetails = stubSkuDetails(productId = "product_a") - val activity: Activity = mockk() - billingClientStateListener!!.onBillingSetupFinished(BillingClient.BillingResponseCode.OK.buildResult()) wrapper.makePurchaseAsync( - activity, + mockActivity, appUserId, skuDetails.toStoreProduct(), mockReplaceSkuInfo(),