Search in sources :

Example 1 with MockSuccessAuthorizationResultMockedTests

use of com.microsoft.identity.internal.testutils.mocks.MockSuccessAuthorizationResultMockedTests in project microsoft-authentication-library-common-for-android by AzureAD.

the class MockStrategyWithMockedHttpResponse method requestAuthorization.

/**
 * Template method for executing an OAuth2 authorization request.
 *
 * @param request               microsoft sts authorization request.
 * @param authorizationStrategy authorization strategy.
 * @return GenericAuthorizationResponse
 */
@Override
public Future<AuthorizationResult> requestAuthorization(final MicrosoftStsAuthorizationRequest request, final AuthorizationStrategy authorizationStrategy) {
    final MockSuccessAuthorizationResultMockedTests authorizationResult = new MockSuccessAuthorizationResultMockedTests();
    final ResultFuture<AuthorizationResult> future = new ResultFuture<>();
    future.setResult(authorizationResult);
    return future;
}
Also used : ResultFuture(com.microsoft.identity.common.internal.result.ResultFuture) MockSuccessAuthorizationResultMockedTests(com.microsoft.identity.internal.testutils.mocks.MockSuccessAuthorizationResultMockedTests) AuthorizationResult(com.microsoft.identity.common.internal.providers.oauth2.AuthorizationResult)

Example 2 with MockSuccessAuthorizationResultMockedTests

use of com.microsoft.identity.internal.testutils.mocks.MockSuccessAuthorizationResultMockedTests in project microsoft-authentication-library-common-for-android by AzureAD.

the class MockTestStrategy method requestAuthorization.

/**
 * Template method for executing an OAuth2 authorization request.
 *
 * @param request               microsoft sts authorization request.
 * @param authorizationStrategy authorization strategy.
 * @return GenericAuthorizationResponse
 */
@Override
public Future<AuthorizationResult> requestAuthorization(final MicrosoftStsAuthorizationRequest request, final AuthorizationStrategy authorizationStrategy) {
    final MockSuccessAuthorizationResultMockedTests authorizationResult = new MockSuccessAuthorizationResultMockedTests();
    final ResultFuture<AuthorizationResult> future = new ResultFuture<>();
    future.setResult(authorizationResult);
    return future;
}
Also used : ResultFuture(com.microsoft.identity.common.internal.result.ResultFuture) MockSuccessAuthorizationResultMockedTests(com.microsoft.identity.internal.testutils.mocks.MockSuccessAuthorizationResultMockedTests) AuthorizationResult(com.microsoft.identity.common.internal.providers.oauth2.AuthorizationResult)

Aggregations

AuthorizationResult (com.microsoft.identity.common.internal.providers.oauth2.AuthorizationResult)2 ResultFuture (com.microsoft.identity.common.internal.result.ResultFuture)2 MockSuccessAuthorizationResultMockedTests (com.microsoft.identity.internal.testutils.mocks.MockSuccessAuthorizationResultMockedTests)2