Search in sources :

Example 1 with BraintreeApiErrorResponse

use of com.braintreepayments.api.exceptions.BraintreeApiErrorResponse in project braintree_android by braintree.

the class IdealTest method startPayment_returnsError_whenOrderId_isAbsent.

@Test(timeout = 10000)
public void startPayment_returnsError_whenOrderId_isAbsent() throws InterruptedException {
    IdealRequest builder = new IdealRequest().currency("EUR").amount("10").issuerId("INGBNL2A");
    Ideal.startPayment(mBraintreeFragment, builder, null);
    mBraintreeFragment.addListener(new BraintreeErrorListener() {

        @Override
        public void onError(Exception error) {
            assertTrue(error instanceof BraintreeApiErrorResponse);
            mCountDownLatch.countDown();
        }
    });
    mBraintreeFragment.addListener(new BraintreePaymentResultListener() {

        @Override
        public void onBraintreePaymentResult(BraintreePaymentResult result) {
            fail("BraintreeApiErrorResponse expected");
        }
    });
    mCountDownLatch.await();
}
Also used : BraintreePaymentResult(com.braintreepayments.api.models.BraintreePaymentResult) BraintreeApiErrorResponse(com.braintreepayments.api.exceptions.BraintreeApiErrorResponse) IdealRequest(com.braintreepayments.api.models.IdealRequest) BraintreeErrorListener(com.braintreepayments.api.interfaces.BraintreeErrorListener) InvalidArgumentException(com.braintreepayments.api.exceptions.InvalidArgumentException) BraintreePaymentResultListener(com.braintreepayments.api.interfaces.BraintreePaymentResultListener) Test(org.junit.Test)

Aggregations

BraintreeApiErrorResponse (com.braintreepayments.api.exceptions.BraintreeApiErrorResponse)1 InvalidArgumentException (com.braintreepayments.api.exceptions.InvalidArgumentException)1 BraintreeErrorListener (com.braintreepayments.api.interfaces.BraintreeErrorListener)1 BraintreePaymentResultListener (com.braintreepayments.api.interfaces.BraintreePaymentResultListener)1 BraintreePaymentResult (com.braintreepayments.api.models.BraintreePaymentResult)1 IdealRequest (com.braintreepayments.api.models.IdealRequest)1 Test (org.junit.Test)1