Skip to content

Commit

Permalink
[Es-722]
Browse files Browse the repository at this point in the history
Signed-off-by: Venkata Saidurga Polamraju <[email protected]>
  • Loading branch information
pvsaidurga committed Jan 30, 2024
1 parent fd8a679 commit e3a19fa
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,23 @@ public void doGenerateChallenge_withRegistrationPurpose_thenPass() throws Except
.andExpect(jsonPath("$.errors").isEmpty());
}

@Test
public void doGenerateChallenge_withNullPurpose_returnErrorResponse() throws Exception {
String status = "SUCCESSFUL";
GenerateChallengeResponse generateChallengeResponse = new GenerateChallengeResponse(status);
generateChallengeRequest.setPurpose(null);
when(registrationService.generateChallenge(generateChallengeRequest, ""))
.thenReturn(generateChallengeResponse);

mockMvc.perform(post("/registration/generate-challenge")
.content(objectMapper.writeValueAsString(wrapper))
.contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(jsonPath("$.response").isEmpty())
.andExpect(jsonPath("$.errors").isNotEmpty())
.andExpect(jsonPath("$.errors[0].errorCode").value(ErrorConstants.INVALID_PURPOSE));
}

@Test
public void doGenerateChallenge_withResetPasswordPurpose_thenPass() throws Exception {
String status = "SUCCESSFUL";
Expand Down

0 comments on commit e3a19fa

Please sign in to comment.