Search in sources :

Example 1 with MockResultCallback

use of com.okta.oidc.util.MockResultCallback in project okta-oidc-android by okta.

the class SyncAuthClientTest method signOutWithCallback.

@Test
public void signOutWithCallback() throws InterruptedException {
    mEndPoint.enqueueReturnSuccessEmptyBody();
    mEndPoint.enqueueReturnSuccessEmptyBody();
    MockResultCallback<Integer, AuthorizationException> mockCallback = new MockResultCallback<>();
    mAuthClient.signOut(mockCallback);
    // wait for request to be created
    Thread.sleep(200);
    RecordedRequest recordedRequest = mEndPoint.takeRequest();
    assertThat(recordedRequest.getPath(), equalTo("/revoke?client_id=CLIENT_ID&token=ACCESS_TOKEN"));
    recordedRequest = mEndPoint.takeRequest();
    assertThat(recordedRequest.getPath(), equalTo("/revoke?client_id=CLIENT_ID&token=REFRESH_TOKEN"));
    int status = mockCallback.getResult();
    assertEquals(status, SUCCESS);
}
Also used : RecordedRequest(okhttp3.mockwebserver.RecordedRequest) AuthorizationException(com.okta.oidc.util.AuthorizationException) MockResultCallback(com.okta.oidc.util.MockResultCallback) MockEndPoint(com.okta.oidc.util.MockEndPoint) Test(org.junit.Test)

Aggregations

AuthorizationException (com.okta.oidc.util.AuthorizationException)1 MockEndPoint (com.okta.oidc.util.MockEndPoint)1 MockResultCallback (com.okta.oidc.util.MockResultCallback)1 RecordedRequest (okhttp3.mockwebserver.RecordedRequest)1 Test (org.junit.Test)1