Skip to content

Commit

Permalink
Merge pull request #1806 from Khuddusshariff0022/1.1.5.5_MOSIP_30470_…
Browse files Browse the repository at this point in the history
…UIN_Generation_failed_Invalid_Input_Parameter_1

MOSIP-30470 test case with empty error responce added
  • Loading branch information
vishwa-vyom authored Dec 18, 2023
2 parents 4e69f26 + 47d58c7 commit 93adae7
Showing 1 changed file with 44 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2620,4 +2620,48 @@ public void testUinGenerationResponseWillExcedesRetryCount() throws Exception {
MessageDTO result = uinGeneratorStage.process(messageDTO);
assertTrue(result.getInternalError());
}
@Test
public void testUinGenerationSuccessWithoutUINwithErrorAsEmpty() throws Exception {
MessageDTO messageDTO = new MessageDTO();
messageDTO.setRid("27847657360002520181210094052");
String str = "{\"id\":\"mosip.id.read\",\"version\":\"1.0\",\"responsetime\":\"2019-04-05\",\"metadata\":null,\"response\":{\"uin\":\"2812936908\"},\"errors\":[{\"errorCode\":null,\"errorMessage\":null}]}";
String response = "{\"uin\":\"6517036426\",\"status\":\"ASSIGNED\"}";
when(registrationProcessorRestClientService.getApi(any(), any(), anyString(), any(), any())).thenReturn(str);
when(registrationProcessorRestClientService.putApi(any(), any(), any(), any(), any(), any(), any()))
.thenReturn(response);
messageDTO.setReg_type(RegistrationType.NEW);
IdResponseDTO idResponseDTO = new IdResponseDTO();
ResponseDTO responseDTO = new ResponseDTO();
responseDTO.setEntity("https://dev.mosip.io/idrepo/v1.0/identity/203560486746");
responseDTO.setStatus("ACTIVATED");
List<ErrorDTO> errorList=new ArrayList<>();
idResponseDTO.setErrors(errorList);
idResponseDTO.setId("mosip.id.create");
idResponseDTO.setResponse(responseDTO);
idResponseDTO.setResponsetime("2019-01-17T06:29:01.940Z");
idResponseDTO.setVersion("1.0");

ResponseWrapper<VidResponseDto> responseVid = new ResponseWrapper<VidResponseDto>();
List<ErrorDTO> errors = new ArrayList<>();
responseVid.setErrors(errors);
responseVid.setVersion("v1");
responseVid.setMetadata(null);
DateTimeFormatter format = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
LocalDateTime localdatetime = LocalDateTime
.parse(DateUtils.getUTCCurrentDateTimeString("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"), format);
responseVid.setResponsetime(localdatetime);
VidResponseDto vidResponseDto = new VidResponseDto();
vidResponseDto.setVID("123456");
vidResponseDto.setVidStatus("ACTIVE");
responseVid.setResponse(vidResponseDto);

when(registrationProcessorRestClientService.postApi(any(), any(), any(), any(), any(Class.class)))
.thenReturn(idResponseDTO).thenReturn(responseVid).thenReturn(response);

// Mockito.when(registrationProcessorRestClientService.postApi(any(), any(),
// any(), any(), any()));

MessageDTO result = uinGeneratorStage.process(messageDTO);
assertFalse(result.getInternalError());
}
}

0 comments on commit 93adae7

Please sign in to comment.