Skip to content

Commit

Permalink
Convert error to cause
Browse files Browse the repository at this point in the history
  • Loading branch information
sarahkoop committed Dec 7, 2023
1 parent 110ba31 commit f5e5c19
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ sealed class GooglePayReadinessResult {
object ReadyToPay : GooglePayReadinessResult()

/**
* The Google Pay API is supported or not set up on this device, or there was an [error]
* The Google Pay API is supported or not set up on this device, or there was an issue [cause]
* determining readiness.
*/
class NotReadyToPay(val error: Exception?) : GooglePayReadinessResult()
class NotReadyToPay(val cause: Throwable?) : GooglePayReadinessResult()
}
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ public void isReadyToPay_whenActivityIsNull_forwardsErrorToCallback() {

GooglePayReadinessResult result = captor.getValue();
assertTrue(result instanceof GooglePayReadinessResult.NotReadyToPay);
Exception exception = ((GooglePayReadinessResult.NotReadyToPay) result).getError();
Throwable exception = ((GooglePayReadinessResult.NotReadyToPay) result).getCause();
assertTrue(exception instanceof IllegalArgumentException);
assertEquals("Activity cannot be null.", exception.getMessage());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ class GooglePayInternalClientUnitTest {
sut.isReadyToPay(activity, configuration, isReadyToPayRequest) { readyToPayResult ->
assertTrue(readyToPayResult is GooglePayReadinessResult.NotReadyToPay)
assertSame(expectedError, (readyToPayResult as GooglePayReadinessResult.NotReadyToPay)
.error)
.cause)
countDownLatch.countDown()
}
countDownLatch.await()
Expand Down

0 comments on commit f5e5c19

Please sign in to comment.