use of com.okta.oidc.net.response.web.LogoutResponse in project okta-oidc-android by okta.
the class AuthenticationResultHandlerTest method onActivityResultSignOutSuccess.
@Test
public void onActivityResultSignOutSuccess() throws InterruptedException {
Intent intent = new Intent();
intent.setData(Uri.parse("com.okta.test:/logout?state=" + CUSTOM_STATE));
CountDownLatch latch = new CountDownLatch(1);
final StateResult[] stateResult = new StateResult[1];
final ResultType[] stateType = new ResultType[1];
AuthenticationResultHandler.handler().setAuthenticationListener((result, type) -> {
stateResult[0] = result;
stateType[0] = type;
latch.countDown();
});
AuthenticationResultHandler.handler().onActivityResult(REQUEST_CODE_SIGN_OUT, RESULT_OK, intent);
latch.await();
assertNotNull(stateResult[0]);
LogoutResponse response = (LogoutResponse) stateResult[0].getAuthorizationResponse();
assertNotNull(response);
assertEquals(stateResult[0].getStatus(), LOGGED_OUT);
assertEquals(response.getState(), CUSTOM_STATE);
assertEquals(stateType[0], ResultType.SIGN_OUT);
assertNull(AuthenticationResultHandler.handler().mCachedResult);
assertNull(AuthenticationResultHandler.handler().mCachedResultType);
}
Aggregations