use of com.okta.oidc.AuthenticationResultHandler.Status.CANCELED in project okta-oidc-android by okta.
the class AuthenticationResultHandlerTest method setAuthenticationListener.
@Test
public void setAuthenticationListener() throws InterruptedException {
AuthenticationResultHandler.handler().mCachedResult = StateResult.canceled();
AuthenticationResultHandler.handler().mCachedResultType = ResultType.SIGN_IN;
final StateResult[] resultFromListener = new StateResult[1];
final ResultType[] typeFromListener = new ResultType[1];
CountDownLatch latch = new CountDownLatch(1);
AuthResultListener listener = (result, type) -> {
resultFromListener[0] = result;
typeFromListener[0] = type;
latch.countDown();
};
AuthenticationResultHandler.handler().setAuthenticationListener(listener);
latch.await();
assertEquals(resultFromListener[0].getStatus(), CANCELED);
assertEquals(typeFromListener[0], ResultType.SIGN_IN);
assertNull(AuthenticationResultHandler.handler().mCachedResult);
assertNull(AuthenticationResultHandler.handler().mCachedResultType);
}
Aggregations