use of com.microsoft.identity.common.exception.BaseException 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);
}
}
use of com.microsoft.identity.common.exception.BaseException 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);
}
}
use of com.microsoft.identity.common.exception.BaseException 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.");
}
}
use of com.microsoft.identity.common.exception.BaseException 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);
}
}
use of com.microsoft.identity.common.exception.BaseException in project microsoft-authentication-library-common-for-android by AzureAD.
the class IpcStrategyTests method testOperationSucceeds.
protected void testOperationSucceeds(@NonNull final BrokerOperationBundle bundle, @NonNull final Bundle expectedResultBundle) {
final IIpcStrategy strategy = getStrategy();
try {
final Bundle resultBundle = strategy.communicateToBroker(bundle);
Assert.assertNotNull(resultBundle);
Assert.assertTrue(isBundleEqual(resultBundle, expectedResultBundle));
} catch (BaseException e) {
Assert.fail("Exception is not expected.");
}
}
Aggregations