Skip to content

Commit

Permalink
Update error param naming
Browse files Browse the repository at this point in the history
  • Loading branch information
sarahkoop committed Jan 11, 2024
1 parent e9d28ff commit fbac7f3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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() {
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit fbac7f3

Please sign in to comment.