Search in sources :

Example 1 with BrokerOperationExecutor

use of com.microsoft.identity.common.internal.controllers.BrokerOperationExecutor in project microsoft-authentication-library-common-for-android by AzureAD.

the class BrokerOperationExecutorTests method expectCorruptedBundleException.

private void expectCorruptedBundleException(final List<IIpcStrategy> strategyList) {
    try {
        final BrokerOperationExecutor executor = new BrokerOperationExecutor(strategyList);
        executor.execute(getMockParameter(), getBrokerOperation());
        Assert.fail("Failure is expected.");
    } catch (final BaseException e) {
        Assert.assertTrue(e instanceof ClientException);
        Assert.assertEquals(e.getErrorCode(), CORRUPTED_BUNDLE_ERROR_CODE);
    }
}
Also used : BrokerOperationExecutor(com.microsoft.identity.common.internal.controllers.BrokerOperationExecutor) BaseException(com.microsoft.identity.common.exception.BaseException) ClientException(com.microsoft.identity.common.exception.ClientException)

Example 2 with BrokerOperationExecutor

use of com.microsoft.identity.common.internal.controllers.BrokerOperationExecutor in project microsoft-authentication-library-common-for-android by AzureAD.

the class BrokerOperationExecutorTests method expectServiceException.

private void expectServiceException(final List<IIpcStrategy> strategyList) {
    try {
        final BrokerOperationExecutor executor = new BrokerOperationExecutor(strategyList);
        executor.execute(getMockParameter(), getBrokerOperation());
        Assert.fail("Failure is expected.");
    } catch (final BaseException e) {
        Assert.assertTrue(e instanceof ServiceException);
        Assert.assertEquals(e.getErrorCode(), SERVICE_EXCEPTION_BUNDLE_ERROR_CODE);
    }
}
Also used : BrokerOperationExecutor(com.microsoft.identity.common.internal.controllers.BrokerOperationExecutor) BaseException(com.microsoft.identity.common.exception.BaseException) ServiceException(com.microsoft.identity.common.exception.ServiceException)

Example 3 with BrokerOperationExecutor

use of com.microsoft.identity.common.internal.controllers.BrokerOperationExecutor in project microsoft-authentication-library-common-for-android by AzureAD.

the class BrokerOperationExecutorTests method expectValidResult.

private void expectValidResult(final List<IIpcStrategy> strategyList) {
    try {
        final BrokerOperationExecutor executor = new BrokerOperationExecutor(strategyList);
        Assert.assertTrue(executor.execute(getMockParameter(), getBrokerOperation()));
    } catch (final BaseException e) {
        Assert.fail("Unexpected exception.");
    }
}
Also used : BrokerOperationExecutor(com.microsoft.identity.common.internal.controllers.BrokerOperationExecutor) BaseException(com.microsoft.identity.common.exception.BaseException)

Example 4 with BrokerOperationExecutor

use of com.microsoft.identity.common.internal.controllers.BrokerOperationExecutor in project microsoft-authentication-library-common-for-android by AzureAD.

the class BrokerOperationExecutorTests method expectUserCancelledException.

private void expectUserCancelledException(final List<IIpcStrategy> strategyList) {
    try {
        final BrokerOperationExecutor executor = new BrokerOperationExecutor(strategyList);
        executor.execute(getMockParameter(), getBrokerOperation());
        Assert.fail("Failure is expected.");
    } catch (final BaseException e) {
        Assert.assertTrue(e instanceof UserCancelException);
    }
}
Also used : BrokerOperationExecutor(com.microsoft.identity.common.internal.controllers.BrokerOperationExecutor) BaseException(com.microsoft.identity.common.exception.BaseException) UserCancelException(com.microsoft.identity.common.exception.UserCancelException)

Example 5 with BrokerOperationExecutor

use of com.microsoft.identity.common.internal.controllers.BrokerOperationExecutor in project microsoft-authentication-library-common-for-android by AzureAD.

the class BrokerOperationExecutorTests method expectBindFailureException.

private void expectBindFailureException(final List<IIpcStrategy> strategyList) {
    try {
        final BrokerOperationExecutor executor = new BrokerOperationExecutor(strategyList);
        executor.execute(getMockParameter(), getBrokerOperation());
        Assert.fail("Failure is expected.");
    } catch (final BaseException e) {
        Assert.assertTrue(e instanceof ClientException);
        Assert.assertEquals(e.getErrorCode(), ErrorStrings.BROKER_BIND_SERVICE_FAILED);
        Assert.assertEquals(e.getSuppressed().length, strategyList.size());
    }
}
Also used : BrokerOperationExecutor(com.microsoft.identity.common.internal.controllers.BrokerOperationExecutor) BaseException(com.microsoft.identity.common.exception.BaseException) ClientException(com.microsoft.identity.common.exception.ClientException)

Aggregations

BaseException (com.microsoft.identity.common.exception.BaseException)5 BrokerOperationExecutor (com.microsoft.identity.common.internal.controllers.BrokerOperationExecutor)5 ClientException (com.microsoft.identity.common.exception.ClientException)2 ServiceException (com.microsoft.identity.common.exception.ServiceException)1 UserCancelException (com.microsoft.identity.common.exception.UserCancelException)1