use of com.okta.oidc.net.response.UserInfo in project okta-oidc-android by okta.
the class SessionClientImplTest method getUserProfile.
@Test
public void getUserProfile() throws InterruptedException, JSONException {
mEndPoint.enqueueUserInfoSuccess();
final CountDownLatch latch = new CountDownLatch(1);
MockRequestCallback<UserInfo, AuthorizationException> cb = new MockRequestCallback<>(latch);
mSessionClient.getUserProfile(cb);
RecordedRequest recordedRequest = mEndPoint.takeRequest();
latch.await();
UserInfo result = cb.getResult();
assertThat(recordedRequest.getHeader("Authorization"), is("Bearer " + ACCESS_TOKEN));
assertThat(recordedRequest.getHeader("Accept"), is(ConnectionParameters.JSON_CONTENT_TYPE));
assertThat(recordedRequest.getPath(), equalTo("/userinfo"));
assertNotNull(result);
assertEquals("John Doe", result.get("name"));
assertEquals("Jimmy", result.get("nickname"));
}
Aggregations