IMPORTANT: The file content has been truncated. Status: Showing lines 100-150 of 608 total lines. Action: To read more of the file, you can use the 'start_line' and 'end_line' parameters in a subsequent 'read_file' call. For example, to read the next section of the file, use start_line: 151. --- FILE CONTENT (truncated) --- return purchase } /** * Captures the [BillingClientStateListener] passed to [BillingClient.startConnection] * and immediately fires [BillingClientStateListener.onBillingSetupFinished] with [result]. */ private fun stubStartConnectionOk() { val listenerSlot = slot() every { mockBillingClient.startConnection(capture(listenerSlot)) } answers { listenerSlot.captured.onBillingSetupFinished(okResult()) } every { mockBillingClient.isReady } returns true } /** * Stubs [BillingClient.queryPurchasesAsync] to invoke the [PurchasesResponseListener] * synchronously with [billingResult] and [purchases]. */ private fun stubQueryPurchases( billingResult: BillingResult, purchases: List = emptyList(), ) { val listenerSlot = slot() every { mockBillingClient.queryPurchasesAsync(any(), capture(listenerSlot)) } answers { listenerSlot.captured.onQueryPurchasesResponse(billingResult, purchases) } } /** * Stubs [BillingClient.queryProductDetailsAsync] to invoke the [ProductDetailsResponseListener] * synchronously with an OK result and empty list (product details pre-fetched for launch). */ private fun stubQueryProductDetailsOk(details: ProductDetails = mockk(relaxed = true)) { val listenerSlot = slot() every { mockBillingClient.queryProductDetailsAsync(any(), capture(listenerSlot)) } answers { listenerSlot.captured.onProductDetailsResponse(okResult(), listOf(details)) } } /** * Stubs [BillingClient.acknowledgePurchase] to invoke the * [AcknowledgePurchaseResponseListener] synchronously with an OK result. */ private fun stubAcknowledgePurchaseOk() { val listenerSlot = slot() every {