Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed test cases error. #1095

Merged
merged 1 commit into from
Sep 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public class AuthAnonymousProfileServiceImplTest {
Map<String, Object> requestMetadata = null;
Map<String, Object> responseMetadata = null;
Map<String,List<IdentityInfoDTO>> idInfoMap = null;
List<AuthError> errorCodes = null;

@Before
public void before() {
Expand All @@ -79,6 +80,7 @@ public void before() {
requestMetadata = new HashMap<>();
responseMetadata = new HashMap<>();
idInfoMap = new HashMap<String, List<IdentityInfoDTO>>();
errorCodes = new ArrayList<>();

ReflectionTestUtils.setField(anonymousProfileServiceImpl, "mapper", mapper);
ReflectionTestUtils.setField(idInfoHelper, "idInfoFetcher", idInfoFetcherImpl);
Expand All @@ -103,7 +105,7 @@ public void createAnonymousProfileWith_YourOfBirthTest() throws IdAuthentication
responseBody.put("response", authResponse);

Mockito.when(idInfoHelper.getEntityInfoAsString(DemoMatchType.DOB, idInfoMap)).thenReturn("1993/04/11");
AnonymousAuthenticationProfile anonymousProfile = ReflectionTestUtils.invokeMethod(anonymousProfileServiceImpl, "createAnonymousProfile",requestBody, requestMetadata, responseMetadata, true, null);
AnonymousAuthenticationProfile anonymousProfile = ReflectionTestUtils.invokeMethod(anonymousProfileServiceImpl, "createAnonymousProfile",requestBody, requestMetadata, responseMetadata, true, errorCodes);
assertEquals(anonymousProfile.getYearOfBirth(), "1993");
}

Expand All @@ -123,7 +125,7 @@ public void createAnonymousProfileWith_PreferredLangTest() throws IdAuthenticati
responseBody.put("response", authResponse);

Mockito.when(idInfoHelper.getDynamicEntityInfoAsString(idInfoMap, null, "preferredLanguage")).thenReturn("eng");
AnonymousAuthenticationProfile anonymousProfile = ReflectionTestUtils.invokeMethod(anonymousProfileServiceImpl, "createAnonymousProfile",requestBody, requestMetadata, responseMetadata, true, null);
AnonymousAuthenticationProfile anonymousProfile = ReflectionTestUtils.invokeMethod(anonymousProfileServiceImpl, "createAnonymousProfile",requestBody, requestMetadata, responseMetadata, true, errorCodes);
assertEquals(List.of("eng"), anonymousProfile.getPreferredLanguages());
}

Expand All @@ -143,7 +145,7 @@ public void createAnonymousProfileWith_GenderTest() throws IdAuthenticationBusin
responseBody.put("response", authResponse);

Mockito.when(idInfoHelper.getEntityInfoAsString(DemoMatchType.GENDER, "eng", idInfoMap)).thenReturn("Female");
AnonymousAuthenticationProfile anonymousProfile = ReflectionTestUtils.invokeMethod(anonymousProfileServiceImpl, "createAnonymousProfile",requestBody,requestMetadata, responseMetadata, true, null);
AnonymousAuthenticationProfile anonymousProfile = ReflectionTestUtils.invokeMethod(anonymousProfileServiceImpl, "createAnonymousProfile",requestBody,requestMetadata, responseMetadata, true, errorCodes);
assertEquals("Female", anonymousProfile.getGender());
}

Expand All @@ -168,7 +170,7 @@ public void createAnonymousProfileWith_LocationTest() throws IdAuthenticationBus
responseBody.put("response", authResponse);

Mockito.when(idInfoHelper.getIdEntityInfoMap(DemoMatchType.DYNAMIC, idInfoMap, "eng", "locationHierarchyForProfiling")).thenReturn(locationMap);
AnonymousAuthenticationProfile anonymousProfile = ReflectionTestUtils.invokeMethod(anonymousProfileServiceImpl, "createAnonymousProfile",requestBody, requestMetadata, responseMetadata, true, null);
AnonymousAuthenticationProfile anonymousProfile = ReflectionTestUtils.invokeMethod(anonymousProfileServiceImpl, "createAnonymousProfile",requestBody, requestMetadata, responseMetadata, true, errorCodes);
assertEquals(List.of("zone1", "123456"), anonymousProfile.getLocation());
}

Expand Down Expand Up @@ -202,7 +204,7 @@ public void createAnonymousProfileWith_BiometricInfoTest() throws IdAuthenticati
authResponse.put("authStatus", "true");
authResponse.put("authToken", "1234567890");
responseBody.put("response", authResponse);
AnonymousAuthenticationProfile anonymousProfile = ReflectionTestUtils.invokeMethod(anonymousProfileServiceImpl, "createAnonymousProfile",requestBody, requestMetadata, responseMetadata, true, null);
AnonymousAuthenticationProfile anonymousProfile = ReflectionTestUtils.invokeMethod(anonymousProfileServiceImpl, "createAnonymousProfile",requestBody, requestMetadata, responseMetadata, true, errorCodes);
assertEquals(1, anonymousProfile.getBiometricInfo().size());
assertEquals("Iris", anonymousProfile.getBiometricInfo().get(0).getType());
assertEquals("LEFT", anonymousProfile.getBiometricInfo().get(0).getSubtype());
Expand All @@ -221,7 +223,7 @@ public void createAnonymousProfileWith_AuthFactorsTest() throws IdAuthentication
authResponse.put("authToken", "1234567890");
responseBody.put("response", authResponse);

AnonymousAuthenticationProfile anonymousProfile = ReflectionTestUtils.invokeMethod(anonymousProfileServiceImpl, "createAnonymousProfile",requestBody, requestMetadata, responseMetadata, true, null);
AnonymousAuthenticationProfile anonymousProfile = ReflectionTestUtils.invokeMethod(anonymousProfileServiceImpl, "createAnonymousProfile",requestBody, requestMetadata, responseMetadata, true, errorCodes);
assertEquals(3, anonymousProfile.getAuthFactors().size());
assertEquals(List.of("OTP-REQUEST","DEMO-AUTH","BIO-AUTH"), anonymousProfile.getAuthFactors());

Expand All @@ -234,7 +236,7 @@ public void createAnonymousProfileWith_PartnerTest() throws IdAuthenticationBusi
partner.setPartnerId("abc");
requestMetadata.put("partnerId", "abc");
requestMetadata.put("abc", partner);
AnonymousAuthenticationProfile anonymousProfile = ReflectionTestUtils.invokeMethod(anonymousProfileServiceImpl, "createAnonymousProfile",requestBody, requestMetadata, responseMetadata, true, null);
AnonymousAuthenticationProfile anonymousProfile = ReflectionTestUtils.invokeMethod(anonymousProfileServiceImpl, "createAnonymousProfile",requestBody, requestMetadata, responseMetadata, true, errorCodes);
assertEquals(partner.getPartnerName(), anonymousProfile.getPartnerName());
}

Expand Down