Search in sources :

Example 6 with IinLookupAsyncTask

use of com.globalcollect.gateway.sdk.client.android.sdk.asynctask.IinLookupAsyncTask in project connect-sdk-client-android by Ingenico-ePayments.

the class GetIinDetailsAsyncTaskTest method testGetIinDetailsAsyncTaskSUPPORTEDWithValidRequest.

@Test
public void testGetIinDetailsAsyncTaskSUPPORTEDWithValidRequest() throws InterruptedException, CommunicationException {
    initializeValidMocksAndSession();
    final CountDownLatch waitForAsyncTaskCallBack = new CountDownLatch(1);
    // Create the IinLookupAsyncTask and then begin the test by calling execute.
    List<IinLookupAsyncTask.OnIinLookupCompleteListener> listeners = new ArrayList<>(1);
    Listener listener = new Listener(waitForAsyncTaskCallBack);
    listeners.add(listener);
    IinLookupAsyncTask iinLookupAsyncTask = new IinLookupAsyncTask(getContext(), // Visa number
    "401200", getCommunicator(), listeners, minimalValidPaymentContext);
    iinLookupAsyncTask.execute();
    // Test that the response is received within 'ASYNCTASK_CALLBACK_TEST_TIMEOUT_SEC' seconds
    assertTrue(waitForAsyncTaskCallBack.await(ASYNCTASK_CALLBACK_TEST_TIMEOUT_SEC, TimeUnit.SECONDS));
    // Retrieve the iin details response from the listener
    IinDetailsResponse iinDetailsResponse = listener.getIinDetailsResponse();
    validateResponseStatusSUPPORTED(iinDetailsResponse);
}
Also used : IinDetailsResponse(com.globalcollect.gateway.sdk.client.android.sdk.model.iin.IinDetailsResponse) ArrayList(java.util.ArrayList) IinLookupAsyncTask(com.globalcollect.gateway.sdk.client.android.sdk.asynctask.IinLookupAsyncTask) CountDownLatch(java.util.concurrent.CountDownLatch) Test(org.junit.Test)

Aggregations

IinLookupAsyncTask (com.globalcollect.gateway.sdk.client.android.sdk.asynctask.IinLookupAsyncTask)6 ArrayList (java.util.ArrayList)6 IinDetailsResponse (com.globalcollect.gateway.sdk.client.android.sdk.model.iin.IinDetailsResponse)5 CountDownLatch (java.util.concurrent.CountDownLatch)5 Test (org.junit.Test)5 OnIinLookupCompleteListener (com.globalcollect.gateway.sdk.client.android.sdk.asynctask.IinLookupAsyncTask.OnIinLookupCompleteListener)1 AmountOfMoney (com.globalcollect.gateway.sdk.client.android.sdk.model.AmountOfMoney)1 PaymentContext (com.globalcollect.gateway.sdk.client.android.sdk.model.PaymentContext)1 InvalidParameterException (java.security.InvalidParameterException)1