use of com.braintreepayments.testutils.TestConfigurationBuilder in project braintree_android by braintree.
the class AndroidPayTest method setup.
@Before
public void setup() {
mLatch = new CountDownLatch(1);
mBaseConfiguration = new TestConfigurationBuilder().androidPay(new TestAndroidPayConfigurationBuilder().googleAuthorizationFingerprint("google-auth-fingerprint")).merchantId("android-pay-merchant-id");
}
use of com.braintreepayments.testutils.TestConfigurationBuilder in project braintree_android by braintree.
the class AndroidPayTest method isReadyToPay_returnsFalseWhenAndroidPayIsNotEnabled.
@Test(timeout = 5000)
public void isReadyToPay_returnsFalseWhenAndroidPayIsNotEnabled() throws Exception {
String configuration = new TestConfigurationBuilder().androidPay(new TestAndroidPayConfigurationBuilder().enabled(false)).build();
BraintreeFragment fragment = getFragment(mActivityTestRule.getActivity(), TOKENIZATION_KEY, configuration);
AndroidPay.isReadyToPay(fragment, new BraintreeResponseListener<Boolean>() {
@Override
public void onResponse(Boolean isReadyToPay) {
assertFalse(isReadyToPay);
mLatch.countDown();
}
});
mLatch.await();
}
use of com.braintreepayments.testutils.TestConfigurationBuilder in project braintree_android by braintree.
the class DataCollectorTest method collectDeviceData_doesNotCollectKountDataIfKountDisabledInConfiguration.
@Test(timeout = 1000)
public void collectDeviceData_doesNotCollectKountDataIfKountDisabledInConfiguration() throws InterruptedException {
BraintreeFragment fragment = getFragmentWithConfiguration(mActivity, new TestConfigurationBuilder().build());
DataCollector.collectDeviceData(fragment, new BraintreeResponseListener<String>() {
@Override
public void onResponse(String deviceData) {
try {
JSONObject json = new JSONObject(deviceData);
assertNull(Json.optString(json, "device_session_id", null));
assertNull(Json.optString(json, "fraud_merchant_id", null));
assertNotNull(json.getString("correlation_id"));
} catch (JSONException e) {
fail(e.getMessage());
}
mCountDownLatch.countDown();
}
});
mCountDownLatch.await();
}
use of com.braintreepayments.testutils.TestConfigurationBuilder in project braintree_android by braintree.
the class DataCollectorTest method collectDeviceData_withListener.
@Test(timeout = 10000)
public void collectDeviceData_withListener() throws InterruptedException {
String configuration = new TestConfigurationBuilder().kount(new TestKountConfigurationBuilder().kountMerchantId("500000")).build();
BraintreeFragment fragment = getFragmentWithConfiguration(mActivity, configuration);
DataCollector.collectDeviceData(fragment, new BraintreeResponseListener<String>() {
@Override
public void onResponse(String deviceData) {
try {
JSONObject json = new JSONObject(deviceData);
assertFalse(TextUtils.isEmpty(json.getString("device_session_id")));
assertEquals("500000", json.getString("fraud_merchant_id"));
assertNotNull(json.getString("correlation_id"));
} catch (JSONException e) {
fail(e.getMessage());
}
mCountDownLatch.countDown();
}
});
mCountDownLatch.await();
}
use of com.braintreepayments.testutils.TestConfigurationBuilder in project braintree_android by braintree.
the class GooglePaymentTest method isReadyToPay_returnsFalseWhenAndroidPayIsNotEnabled.
@Test(timeout = 5000)
public void isReadyToPay_returnsFalseWhenAndroidPayIsNotEnabled() throws Exception {
String configuration = new TestConfigurationBuilder().androidPay(new TestAndroidPayConfigurationBuilder().enabled(false)).build();
BraintreeFragment fragment = getFragment(mActivityTestRule.getActivity(), TOKENIZATION_KEY, configuration);
GooglePayment.isReadyToPay(fragment, new BraintreeResponseListener<Boolean>() {
@Override
public void onResponse(Boolean isReadyToPay) {
assertFalse(isReadyToPay);
mLatch.countDown();
}
});
mLatch.await();
}
Aggregations