use of com.globalcollect.gateway.sdk.client.android.sdk.model.PaymentProductDirectoryResponse in project connect-sdk-client-android by Ingenico-ePayments.
the class GetPaymentProductDirectoryTest method testGetPaymentProductDirectoryAsyncTaskWithInvalidRequest.
/**
* Test that an invalid request for a PaymentProductDirectory will return, but will not contain a PaymentProductDirectoryResponse
*/
@Test
public void testGetPaymentProductDirectoryAsyncTaskWithInvalidRequest() throws InterruptedException {
initializeInValidMocksAndSession();
final CountDownLatch waitForAsyncTaskCallBack = new CountDownLatch(1);
Listener listener = new Listener(waitForAsyncTaskCallBack);
// Create the PaymentProductDirectoryAsyncTask and start the test by running execute
PaymentProductDirectoryAsyncTask paymentProductDirectoryAsyncTask = new PaymentProductDirectoryAsyncTask("809", CurrencyCode.EUR, CountryCode.NL, getContext(), getCommunicator(), listener);
paymentProductDirectoryAsyncTask.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 paymentProductDirectoryResponse from the listener and validate it has the correct fields
PaymentProductDirectoryResponse paymentProductDirectoryResponse = listener.getPaymentProductDirectoryResponse();
assertNull(paymentProductDirectoryResponse);
}
use of com.globalcollect.gateway.sdk.client.android.sdk.model.PaymentProductDirectoryResponse in project connect-sdk-client-android by Ingenico-ePayments.
the class GetPaymentProductDirectoryTest method testGetPaymentProductDirectoryAsyncTaskWithValidRequest.
@Test
public void testGetPaymentProductDirectoryAsyncTaskWithValidRequest() throws InterruptedException, CommunicationException {
initializeValidMocksAndSession();
final CountDownLatch waitForAsyncTaskCallBack = new CountDownLatch(1);
Listener listener = new Listener(waitForAsyncTaskCallBack);
// Create the PaymentProductDirectoryAsyncTask and start the test by running execute
PaymentProductDirectoryAsyncTask paymentProductDirectoryAsyncTask = new PaymentProductDirectoryAsyncTask("809", CurrencyCode.EUR, CountryCode.NL, getContext(), getCommunicator(), listener);
paymentProductDirectoryAsyncTask.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 paymentProductDirectoryResponse from the listener and validate it has the correct fields
PaymentProductDirectoryResponse paymentProductDirectoryResponse = listener.getPaymentProductDirectoryResponse();
assertNotNull(paymentProductDirectoryResponse);
assertNotNull(paymentProductDirectoryResponse.getEntries());
assertFalse(paymentProductDirectoryResponse.getEntries().isEmpty());
}
Aggregations