use of com.fitpay.android.utils.ValidationException in project fitpay-android-sdk by fitpay.
the class Steps method login.
public void login() throws InterruptedException {
final CountDownLatch latch = new CountDownLatch(1);
final boolean[] isRequestSuccess = { false };
LoginIdentity loginIdentity = null;
try {
loginIdentity = new LoginIdentity.Builder().setUsername(userName).setPassword(password).build();
} catch (ValidationException ignored) {
}
Assert.assertNotNull(loginIdentity);
ApiManager.getInstance().loginUser(loginIdentity, new ApiCallback<OAuthToken>() {
@Override
public void onSuccess(OAuthToken result) {
Assert.assertNotNull("missing bearer token", result.getAccessToken());
isRequestSuccess[0] = true;
latch.countDown();
}
@Override
public void onFailure(@ResultCode.Code int errorCode, String errorMessage) {
fail("unable to login: " + errorMessage);
latch.countDown();
}
});
latch.await(TIMEOUT, TimeUnit.SECONDS);
Assert.assertTrue(isRequestSuccess[0]);
}
Aggregations