-
Notifications
You must be signed in to change notification settings - Fork 176
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding testcase for array of string data type
Signed-off-by: khuddus shariff <[email protected]>
- Loading branch information
1 parent
a8a4071
commit cdc871a
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2520,4 +2520,47 @@ public void testUinGenerationSuccessWithSelectedHanhle() throws Exception { | |
assertFalse(result.getInternalError()); | ||
assertTrue(result.getIsValid()); | ||
} | ||
|
||
@Test | ||
public void testUinGenerationSuccessWithObjectDataType () throws Exception { | ||
ReflectionTestUtils.setField(uinGeneratorStage,"trimWhitespaces",true); | ||
Map<String, String> fieldMap = new HashMap<>(); | ||
fieldMap.put("individualBiometrics","{\n" + | ||
" \"format\": \"cbeff\",\n" + | ||
" \"value\": \"individualBiometrics_bio_CBEFF\",\n" + | ||
" \"version\": 1\n" + | ||
" }"); | ||
fieldMap.put("email", "[email protected]"); | ||
fieldMap.put("phoneNumber", "23456"); | ||
fieldMap.put("dob", "11/11/2011"); | ||
when(packetManagerService.getFields(any(),any(),any(),any())).thenReturn(fieldMap); | ||
ArgumentCaptor<io.mosip.registration.processor.packet.manager.dto.IdRequestDto> argumentCaptor = ArgumentCaptor.forClass(IdRequestDto.class); | ||
|
||
MessageDTO messageDTO = new MessageDTO(); | ||
messageDTO.setRid("27847657360002520181210094052"); | ||
messageDTO.setReg_type(RegistrationType.NEW.name()); | ||
|
||
IdResponseDTO idResponseDTO = new IdResponseDTO(); | ||
ResponseDTO responseDTO = new ResponseDTO(); | ||
responseDTO.setStatus("ACTIVATED"); | ||
idResponseDTO.setErrors(null); | ||
idResponseDTO.setId("mosip.id.update"); | ||
idResponseDTO.setResponse(responseDTO); | ||
idResponseDTO.setResponsetime("2019-01-17T06:29:01.940Z"); | ||
idResponseDTO.setVersion("1.0"); | ||
|
||
when(idrepoDraftService.idrepoUpdateDraft(anyString(), any(), any())).thenReturn(idResponseDTO); | ||
when(utility.getRegistrationProcessorMappingJson(MappingJsonConstants.IDENTITY)).thenReturn(identityObj); | ||
when(utility.getRegistrationProcessorMappingJson(MappingJsonConstants.DOCUMENT)).thenReturn(documentObj); | ||
|
||
MessageDTO result = uinGeneratorStage.process(messageDTO); | ||
verify(idrepoDraftService).idrepoUpdateDraft(any(), any(), argumentCaptor.capture()); | ||
ObjectMapper objectMapper = new ObjectMapper(); | ||
String jsonobject=objectMapper.writeValueAsString(argumentCaptor.getAllValues().get(0).getRequest().getIdentity()); | ||
JsonNode jsonNode=objectMapper.readTree(jsonobject); | ||
|
||
assertEquals("cbeff",jsonNode.get("individualBiometrics").get("format").asText()); | ||
assertFalse(result.getInternalError()); | ||
assertTrue(result.getIsValid()); | ||
} | ||
} |