Search in sources :

Example 6 with SecurityQuestionPasswordRecoveryManager

use of org.wso2.carbon.identity.recovery.password.SecurityQuestionPasswordRecoveryManager in project identity-governance by wso2-extensions.

the class ValidateAnswerApiServiceImplTest method testIdentityRecoveryClientExceptionwithCodeforValidateAnswerPost.

@Test
public void testIdentityRecoveryClientExceptionwithCodeforValidateAnswerPost() throws IdentityRecoveryException {
    mockedRecoveryUtil.when(RecoveryUtil::getSecurityQuestionBasedPwdRecoveryManager).thenReturn(securityQuestionPasswordRecoveryManager);
    Mockito.when(securityQuestionPasswordRecoveryManager.validateUserChallengeQuestions(isNull(), anyString(), isNull())).thenThrow(new IdentityRecoveryClientException(IdentityRecoveryConstants.ErrorMessages.ERROR_CODE_INVALID_ANSWER_FOR_SECURITY_QUESTION.getCode(), ""));
    assertEquals(validateAnswerApiService.validateAnswerPost(buildAnswerVerificationRequestDTO()).getStatus(), 412);
}
Also used : IdentityRecoveryClientException(org.wso2.carbon.identity.recovery.IdentityRecoveryClientException) Test(org.testng.annotations.Test)

Aggregations

IdentityRecoveryClientException (org.wso2.carbon.identity.recovery.IdentityRecoveryClientException)5 IdentityRecoveryException (org.wso2.carbon.identity.recovery.IdentityRecoveryException)4 Test (org.testng.annotations.Test)3 SecurityQuestionPasswordRecoveryManager (org.wso2.carbon.identity.recovery.password.SecurityQuestionPasswordRecoveryManager)3 User (org.wso2.carbon.identity.application.common.model.User)2 ChallengeQuestionResponse (org.wso2.carbon.identity.recovery.bean.ChallengeQuestionResponse)2 ChallengeQuestionsResponse (org.wso2.carbon.identity.recovery.bean.ChallengeQuestionsResponse)1 InitiateAllQuestionResponseDTO (org.wso2.carbon.identity.recovery.endpoint.dto.InitiateAllQuestionResponseDTO)1 InitiateQuestionResponseDTO (org.wso2.carbon.identity.recovery.endpoint.dto.InitiateQuestionResponseDTO)1 RetryErrorDTO (org.wso2.carbon.identity.recovery.endpoint.dto.RetryErrorDTO)1