From fbac7f3e053bdb3b8e732e121cf8a9ad539e3cf4 Mon Sep 17 00:00:00 2001 From: Sarah Koop Date: Thu, 11 Jan 2024 15:38:41 -0600 Subject: [PATCH] Update error param naming --- .../api/BrowserSwitchPendingRequest.kt | 4 ++-- .../api/BrowserSwitchClientUnitTest.java | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/browser-switch/src/main/java/com/braintreepayments/api/BrowserSwitchPendingRequest.kt b/browser-switch/src/main/java/com/braintreepayments/api/BrowserSwitchPendingRequest.kt index 8640513e..f7212c58 100644 --- a/browser-switch/src/main/java/com/braintreepayments/api/BrowserSwitchPendingRequest.kt +++ b/browser-switch/src/main/java/com/braintreepayments/api/BrowserSwitchPendingRequest.kt @@ -13,7 +13,7 @@ sealed class BrowserSwitchPendingRequest { class Started(val browserSwitchRequest: BrowserSwitchRequest) : BrowserSwitchPendingRequest() /** - * An [error] occurred launching the browser + * An error with [cause] occurred launching the browser */ - class Failure(val error: Exception) : BrowserSwitchPendingRequest() + class Failure(val cause: Exception) : BrowserSwitchPendingRequest() } diff --git a/browser-switch/src/test/java/com/braintreepayments/api/BrowserSwitchClientUnitTest.java b/browser-switch/src/test/java/com/braintreepayments/api/BrowserSwitchClientUnitTest.java index c0fc052c..e8fe3df2 100644 --- a/browser-switch/src/test/java/com/braintreepayments/api/BrowserSwitchClientUnitTest.java +++ b/browser-switch/src/test/java/com/braintreepayments/api/BrowserSwitchClientUnitTest.java @@ -90,7 +90,7 @@ public void start_whenActivityIsFinishing_throwsException() { BrowserSwitchPendingRequest request = sut.start(componentActivity, options); assertTrue(request instanceof BrowserSwitchPendingRequest.Failure); - assertEquals(((BrowserSwitchPendingRequest.Failure) request).getError().getMessage(), "Unable to start browser switch while host Activity is finishing."); + assertEquals(((BrowserSwitchPendingRequest.Failure) request).getCause().getMessage(), "Unable to start browser switch while host Activity is finishing."); } @Test @@ -134,7 +134,7 @@ public void start_whenNoBrowserAvailable_returnsFailure() { .metadata(metadata); BrowserSwitchPendingRequest request = sut.start(componentActivity, options); assertTrue(request instanceof BrowserSwitchPendingRequest.Failure); - assertEquals(((BrowserSwitchPendingRequest.Failure) request).getError().getMessage(), "Unable to start browser switch without a web browser."); + assertEquals(((BrowserSwitchPendingRequest.Failure) request).getCause().getMessage(), "Unable to start browser switch without a web browser."); } @Test public void start_whenRequestCodeIsIntegerMinValue_returnsFailure() { @@ -150,7 +150,7 @@ public void start_whenRequestCodeIsIntegerMinValue_returnsFailure() { .metadata(metadata); BrowserSwitchPendingRequest request = sut.start(componentActivity, options); assertTrue(request instanceof BrowserSwitchPendingRequest.Failure); - assertEquals(((BrowserSwitchPendingRequest.Failure) request).getError().getMessage(), "Request code cannot be Integer.MIN_VALUE"); + assertEquals(((BrowserSwitchPendingRequest.Failure) request).getCause().getMessage(), "Request code cannot be Integer.MIN_VALUE"); } @Test @@ -171,7 +171,7 @@ public void start_whenDeviceIsNotConfiguredForDeepLinking_returnsFailure() { assertEquals("The return url scheme was not set up, incorrectly set up, or more than one " + "Activity on this device defines the same url scheme in it's Android Manifest. " + "See https://github.com/braintree/browser-switch-android for more information on " + - "setting up a return url scheme.", ((BrowserSwitchPendingRequest.Failure) request).getError().getMessage()); + "setting up a return url scheme.", ((BrowserSwitchPendingRequest.Failure) request).getCause().getMessage()); } @Test @@ -188,7 +188,7 @@ public void start_whenNoReturnUrlSchemeSet_throwsFailure() { .metadata(metadata); BrowserSwitchPendingRequest request = sut.start(componentActivity, options); assertTrue(request instanceof BrowserSwitchPendingRequest.Failure); - assertEquals("A returnUrlScheme is required.", ((BrowserSwitchPendingRequest.Failure) request).getError().getMessage()); + assertEquals("A returnUrlScheme is required.", ((BrowserSwitchPendingRequest.Failure) request).getCause().getMessage()); } @Test