mirror of
https://github.com/flutter/packages.git
synced 2025-06-30 23:03:11 +08:00
[in_app_purchase_android] Bump org.mockito:mockito-core from 4.7.0 to 5.3.1 (#4224)
Takeover of https://github.com/flutter/packages/pull/3805. See the comment here: https://github.com/flutter/packages/pull/3805#issuecomment-1593665184 This pr also removes most usages of `@SuppressWarnings("unchecked")` in `MethodCallHandlerTest.java` by using the `@Captor` annotation to create a class level `resultCaptor`.
This commit is contained in:
@ -1,3 +1,7 @@
|
||||
## 0.3.0+7
|
||||
|
||||
* Bumps org.mockito:mockito-core from 4.7.0 to 5.3.1.
|
||||
|
||||
## 0.3.0+6
|
||||
|
||||
* Bumps org.jetbrains.kotlin:kotlin-bom from 1.8.21 to 1.8.22.
|
||||
|
@ -64,7 +64,7 @@ dependencies {
|
||||
implementation 'com.android.billingclient:billing:5.2.0'
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
testImplementation 'org.json:json:20230618'
|
||||
testImplementation 'org.mockito:mockito-core:4.7.0'
|
||||
testImplementation 'org.mockito:mockito-core:5.3.1'
|
||||
androidTestImplementation 'androidx.test:runner:1.4.0'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
|
||||
}
|
||||
|
@ -74,6 +74,7 @@ import java.util.concurrent.TimeUnit;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.Captor;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
import org.mockito.Spy;
|
||||
@ -88,6 +89,7 @@ public class MethodCallHandlerTest {
|
||||
@Mock Activity activity;
|
||||
@Mock Context context;
|
||||
@Mock ActivityPluginBinding mockActivityPluginBinding;
|
||||
@Captor ArgumentCaptor<HashMap<String, Object>> resultCaptor;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
@ -240,8 +242,6 @@ public class MethodCallHandlerTest {
|
||||
.setDebugMessage("dummy debug message")
|
||||
.build();
|
||||
listenerCaptor.getValue().onProductDetailsResponse(billingResult, productDetailsResponse);
|
||||
@SuppressWarnings("unchecked")
|
||||
ArgumentCaptor<HashMap<String, Object>> resultCaptor = ArgumentCaptor.forClass(HashMap.class);
|
||||
verify(result).success(resultCaptor.capture());
|
||||
HashMap<String, Object> resultData = resultCaptor.getValue();
|
||||
assertEquals(resultData.get("billingResult"), fromBillingResult(billingResult));
|
||||
@ -652,8 +652,6 @@ public class MethodCallHandlerTest {
|
||||
public void queryPurchaseHistoryAsync() {
|
||||
// Set up an established billing client and all our mocked responses
|
||||
establishConnectedBillingClient(null, null);
|
||||
@SuppressWarnings("unchecked")
|
||||
ArgumentCaptor<HashMap<String, Object>> resultCaptor = ArgumentCaptor.forClass(HashMap.class);
|
||||
BillingResult billingResult =
|
||||
BillingResult.newBuilder()
|
||||
.setResponseCode(100)
|
||||
@ -704,8 +702,6 @@ public class MethodCallHandlerTest {
|
||||
.setDebugMessage("dummy debug message")
|
||||
.build();
|
||||
List<Purchase> purchasesList = asList(buildPurchase("foo"));
|
||||
@SuppressWarnings("unchecked")
|
||||
ArgumentCaptor<HashMap<String, Object>> resultCaptor = ArgumentCaptor.forClass(HashMap.class);
|
||||
doNothing()
|
||||
.when(mockMethodChannel)
|
||||
.invokeMethod(eq(ON_PURCHASES_UPDATED), resultCaptor.capture());
|
||||
@ -719,7 +715,6 @@ public class MethodCallHandlerTest {
|
||||
@Test
|
||||
public void consumeAsync() {
|
||||
establishConnectedBillingClient(null, null);
|
||||
ArgumentCaptor<BillingResult> resultCaptor = ArgumentCaptor.forClass(BillingResult.class);
|
||||
BillingResult billingResult =
|
||||
BillingResult.newBuilder()
|
||||
.setResponseCode(100)
|
||||
@ -749,7 +744,6 @@ public class MethodCallHandlerTest {
|
||||
@Test
|
||||
public void acknowledgePurchase() {
|
||||
establishConnectedBillingClient(null, null);
|
||||
ArgumentCaptor<BillingResult> resultCaptor = ArgumentCaptor.forClass(BillingResult.class);
|
||||
BillingResult billingResult =
|
||||
BillingResult.newBuilder()
|
||||
.setResponseCode(100)
|
||||
|
@ -2,7 +2,7 @@ name: in_app_purchase_android
|
||||
description: An implementation for the Android platform of the Flutter `in_app_purchase` plugin. This uses the Android BillingClient APIs.
|
||||
repository: https://github.com/flutter/packages/tree/main/packages/in_app_purchase/in_app_purchase_android
|
||||
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+in_app_purchase%22
|
||||
version: 0.3.0+6
|
||||
version: 0.3.0+7
|
||||
|
||||
environment:
|
||||
sdk: ">=2.18.0 <4.0.0"
|
||||
|
Reference in New Issue
Block a user