use of com.braintreepayments.api.interfaces.BraintreeCancelListener in project braintree_android by braintree.
the class BraintreeFragmentUnitTest method removeListener_noCancelReceived.
@Test
public void removeListener_noCancelReceived() throws InvalidArgumentException {
BraintreeFragment fragment = BraintreeFragment.newInstance(mActivity, TOKENIZATION_KEY);
BraintreeCancelListener listener = new BraintreeCancelListener() {
@Override
public void onCancel(int requestCode) {
fail("Listener was called");
}
};
fragment.addListener(listener);
fragment.removeListener(listener);
fragment.postCancelCallback(42);
}
use of com.braintreepayments.api.interfaces.BraintreeCancelListener in project braintree_android by braintree.
the class ThreeDSecureVerificationTest method performVerification_callsCancelListenerWhenUpIsPressed.
@Test(timeout = 30000)
public void performVerification_callsCancelListenerWhenUpIsPressed() throws InterruptedException {
CardBuilder cardBuilder = new CardBuilder().cardNumber(THREE_D_SECURE_VERIFICATON).expirationDate("12/30");
BraintreeFragment fragment = getFragment();
fragment.addListener(new BraintreeCancelListener() {
@Override
public void onCancel(int requestCode) {
assertEquals(BraintreeRequestCodes.THREE_D_SECURE, requestCode);
mCountDownLatch.countDown();
}
});
ThreeDSecure.performVerification(getFragment(), cardBuilder, TEST_AMOUNT);
waitForView(withId(android.R.id.widget_frame));
onView(withContentDescription("Navigate up")).perform(click());
mCountDownLatch.await();
}
Aggregations