use of com.braintreepayments.api.exceptions.AppSwitchNotAvailableException in project braintree_android by braintree.
the class VenmoUnitTest method performAppSwitch_sendsAnalyticsEventWhenUnavailableAndPostException.
@Test
public void performAppSwitch_sendsAnalyticsEventWhenUnavailableAndPostException() {
Configuration configuration = getConfigurationFromFixture();
BraintreeFragment fragment = new MockFragmentBuilder().configuration(configuration).build();
Venmo.authorizeAccount(fragment, false);
ArgumentCaptor<AppSwitchNotAvailableException> captor = ArgumentCaptor.forClass(AppSwitchNotAvailableException.class);
InOrder order = inOrder(fragment);
order.verify(fragment).sendAnalyticsEvent("pay-with-venmo.selected");
order.verify(fragment).sendAnalyticsEvent("pay-with-venmo.app-switch.failed");
verify(fragment).postCallback(captor.capture());
assertEquals("Venmo is not installed", captor.getValue().getMessage());
}
use of com.braintreepayments.api.exceptions.AppSwitchNotAvailableException in project braintree_android by braintree.
the class VenmoUnitTest method authorizeAccount_postsExceptionWhenNotEnabled.
@Test
public void authorizeAccount_postsExceptionWhenNotEnabled() throws JSONException {
Configuration configuration = new TestConfigurationBuilder().buildConfiguration();
BraintreeFragment fragment = new MockFragmentBuilder().configuration(configuration).build();
Venmo.authorizeAccount(fragment, false);
ArgumentCaptor<AppSwitchNotAvailableException> captor = ArgumentCaptor.forClass(AppSwitchNotAvailableException.class);
verify(fragment).postCallback(captor.capture());
assertEquals("Venmo is not enabled", captor.getValue().getMessage());
}
use of com.braintreepayments.api.exceptions.AppSwitchNotAvailableException in project braintree_android by braintree.
the class VenmoUnitTest method authorizeAccount_postsExceptionWhenNotInstalled.
@Test
public void authorizeAccount_postsExceptionWhenNotInstalled() {
Configuration configuration = getConfigurationFromFixture();
BraintreeFragment fragment = new MockFragmentBuilder().configuration(configuration).build();
Venmo.authorizeAccount(fragment, false);
ArgumentCaptor<AppSwitchNotAvailableException> captor = ArgumentCaptor.forClass(AppSwitchNotAvailableException.class);
verify(fragment).postCallback(captor.capture());
assertEquals("Venmo is not installed", captor.getValue().getMessage());
}
Aggregations