Search in sources :

Example 1 with UnexpectedLambdaException

use of com.amazonaws.services.cognitoidentityprovider.model.UnexpectedLambdaException in project aws-sdk-android by aws-amplify.

the class CognitoIdentityProviderUserPoolTest method signUpInBackgroundUnexpectedLambdaException.

// Sign-up failure
@Test
public void signUpInBackgroundUnexpectedLambdaException() throws Exception {
    testPool = new CognitoUserPool(appContext, TEST_USER_POOL, TEST_CLIENT_ID, TEST_CLIENT_SECRET, mockCSIClient);
    UnexpectedLambdaException exception = new UnexpectedLambdaException("registration failed");
    doThrow(exception).when(mockCSIClient).signUp(any(SignUpRequest.class));
    testPool.signUpInBackground(TEST_USER_NAME, "null", TEST_IN_USER_ATTRIBUTES_LIST, TEST_IN_VALIDATION_DATA, new SignUpHandler() {

        @Override
        public void onSuccess(CognitoUser user, SignUpResult signUpResult) {
            assertNotNull(user);
            assertEquals(TEST_USER_NAME, user.getUserId());
        }

        @Override
        public void onFailure(Exception exception) {
            assertNotNull(exception);
            assertTrue(exception instanceof UnexpectedLambdaException);
        }
    });
}
Also used : CognitoUserPool(com.amazonaws.mobileconnectors.cognitoidentityprovider.CognitoUserPool) SignUpHandler(com.amazonaws.mobileconnectors.cognitoidentityprovider.handlers.SignUpHandler) SignUpRequest(com.amazonaws.services.cognitoidentityprovider.model.SignUpRequest) UnexpectedLambdaException(com.amazonaws.services.cognitoidentityprovider.model.UnexpectedLambdaException) CognitoUser(com.amazonaws.mobileconnectors.cognitoidentityprovider.CognitoUser) UnexpectedLambdaException(com.amazonaws.services.cognitoidentityprovider.model.UnexpectedLambdaException) ResourceNotFoundException(com.amazonaws.services.cognitoidentityprovider.model.ResourceNotFoundException) InvalidParameterException(com.amazonaws.services.cognitoidentityprovider.model.InvalidParameterException) SignUpResult(com.amazonaws.services.cognitoidentityprovider.model.SignUpResult) Test(org.junit.Test)

Example 2 with UnexpectedLambdaException

use of com.amazonaws.services.cognitoidentityprovider.model.UnexpectedLambdaException in project aws-sdk-android by aws-amplify.

the class UnexpectedLambdaExceptionUnmarshaller method unmarshall.

@Override
public AmazonServiceException unmarshall(JsonErrorResponse error) throws Exception {
    UnexpectedLambdaException e = (UnexpectedLambdaException) super.unmarshall(error);
    e.setErrorCode("UnexpectedLambdaException");
    return e;
}
Also used : UnexpectedLambdaException(com.amazonaws.services.cognitoidentityprovider.model.UnexpectedLambdaException)

Aggregations

UnexpectedLambdaException (com.amazonaws.services.cognitoidentityprovider.model.UnexpectedLambdaException)2 CognitoUser (com.amazonaws.mobileconnectors.cognitoidentityprovider.CognitoUser)1 CognitoUserPool (com.amazonaws.mobileconnectors.cognitoidentityprovider.CognitoUserPool)1 SignUpHandler (com.amazonaws.mobileconnectors.cognitoidentityprovider.handlers.SignUpHandler)1 InvalidParameterException (com.amazonaws.services.cognitoidentityprovider.model.InvalidParameterException)1 ResourceNotFoundException (com.amazonaws.services.cognitoidentityprovider.model.ResourceNotFoundException)1 SignUpRequest (com.amazonaws.services.cognitoidentityprovider.model.SignUpRequest)1 SignUpResult (com.amazonaws.services.cognitoidentityprovider.model.SignUpResult)1 Test (org.junit.Test)1