-
Notifications
You must be signed in to change notification settings - Fork 177
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Sowmya Ujjappa Banakar <[email protected]>
- Loading branch information
Sowmya Ujjappa Banakar
committed
Mar 15, 2024
1 parent
fd11532
commit 629afc5
Showing
2 changed files
with
36 additions
and
19 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
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 |
---|---|---|
@@ -1,11 +1,14 @@ | ||
package io.mosip.registration.processor.stages.uigenerator; | ||
|
||
import static org.junit.Assert.*; | ||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertFalse; | ||
import static org.junit.Assert.assertTrue; | ||
import static org.mockito.ArgumentMatchers.any; | ||
import static org.mockito.ArgumentMatchers.anyDouble; | ||
import static org.mockito.ArgumentMatchers.anyList; | ||
import static org.mockito.ArgumentMatchers.anyString; | ||
import static org.mockito.Mockito.*; | ||
import static org.mockito.Mockito.verify; | ||
import static org.mockito.Mockito.when; | ||
|
||
import java.io.ByteArrayInputStream; | ||
import java.io.File; | ||
|
@@ -14,19 +17,13 @@ | |
import java.io.InputStream; | ||
import java.lang.reflect.Field; | ||
import java.nio.charset.StandardCharsets; | ||
import java.time.LocalDateTime; | ||
import java.time.format.DateTimeFormatter; | ||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
import java.util.HashMap; | ||
import java.util.LinkedHashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
import com.fasterxml.jackson.databind.JsonNode; | ||
import io.mosip.kernel.core.util.DateUtils; | ||
import io.mosip.registration.processor.packet.manager.dto.IdRequestDto; | ||
import io.mosip.registration.processor.stages.uingenerator.dto.VidResponseDto; | ||
import org.apache.commons.io.IOUtils; | ||
import org.assertj.core.util.Lists; | ||
import org.json.JSONException; | ||
|
@@ -35,7 +32,12 @@ | |
import org.junit.Ignore; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.mockito.*; | ||
import org.mockito.ArgumentCaptor; | ||
import org.mockito.InjectMocks; | ||
import org.mockito.Mock; | ||
import org.mockito.Mockito; | ||
import org.mockito.MockitoAnnotations; | ||
import org.mockito.Spy; | ||
import org.powermock.api.mockito.PowerMockito; | ||
import org.powermock.core.classloader.annotations.PowerMockIgnore; | ||
import org.powermock.core.classloader.annotations.PrepareForTest; | ||
|
@@ -46,6 +48,7 @@ | |
import org.springframework.web.client.HttpClientErrorException; | ||
import org.springframework.web.client.HttpServerErrorException; | ||
|
||
import com.fasterxml.jackson.databind.JsonNode; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
|
||
import io.mosip.kernel.biometrics.constant.BiometricType; | ||
|
@@ -83,6 +86,7 @@ | |
import io.mosip.registration.processor.core.spi.restclient.RegistrationProcessorRestClientService; | ||
import io.mosip.registration.processor.core.util.JsonUtil; | ||
import io.mosip.registration.processor.core.util.RegistrationExceptionMapperUtil; | ||
import io.mosip.registration.processor.packet.manager.dto.IdRequestDto; | ||
import io.mosip.registration.processor.packet.manager.dto.IdResponseDTO; | ||
import io.mosip.registration.processor.packet.manager.dto.ResponseDTO; | ||
import io.mosip.registration.processor.packet.manager.exception.IdrepoDraftException; | ||
|
@@ -1544,11 +1548,13 @@ public void testLinkSuccessForLostUin() throws Exception { | |
|
||
@Test | ||
public void testLinkSuccessForLostUinAndUpdateContactInfo() throws Exception { | ||
ReflectionTestUtils.setField(uinGeneratorStage, "updateInfo", "phone,email,addressLine1"); | ||
Map<String, String> fieldMap = new HashMap<>(); | ||
fieldMap.put("UIN", "123456"); | ||
fieldMap.put("name", "mono"); | ||
fieldMap.put("email", "[email protected]"); | ||
|
||
fieldMap.put("addressLine1", | ||
"[{\"language\":\"eng\",\"value\":\"abc\"},{\"language\":\"ara\",\"value\":\"abc\"}]"); | ||
List<String> defaultFields = new ArrayList<>(); | ||
defaultFields.add("name"); | ||
defaultFields.add("dob"); | ||
|
@@ -1580,7 +1586,9 @@ public void testLinkSuccessForLostUinAndUpdateContactInfo() throws Exception { | |
idResponseDTO.setResponse(responseDTO); | ||
idResponseDTO.setResponsetime("2019-01-17T06:29:01.940Z"); | ||
idResponseDTO.setVersion("1.0"); | ||
when(packetManagerService.getField(any(), any(), any(),any())).thenReturn("989879234"); | ||
when(packetManagerService.getField(any(), any(), any(), any())).thenReturn("989879234") | ||
.thenReturn("[email protected]") | ||
.thenReturn("[{\"language\":\"eng\",\"value\":\"abc\"},{\"language\":\"ara\",\"value\":\"abc\"}]"); | ||
|
||
when(idrepoDraftService.idrepoUpdateDraft(anyString(), any(), any())).thenReturn(idResponseDTO); | ||
when(registrationProcessorRestClientService.postApi(any(), any(), any(), any(), any(Class.class))) | ||
|