aboutsummaryrefslogtreecommitdiff
path: root/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskTest.java')
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskTest.java41
1 files changed, 35 insertions, 6 deletions
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskTest.java b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskTest.java
index b3ba8a9d..74ac065e 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskTest.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskTest.java
@@ -48,7 +48,6 @@ import org.apache.commons.lang3.RandomStringUtils;
import org.jetbrains.annotations.NotNull;
import org.junit.Assert;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
@@ -181,15 +180,17 @@ public class InitialSearchTaskTest {
@DirtiesContext
public void singlePersonalIdMatchUpdateNecessary_Zmr() throws Exception {
String oldGivenName = randomAlphabetic(10);
+ String placeOfBirth = randomAlphabetic(10);
+ RegisterResult firstZmrResult = randomRegisterResult(oldGivenName, randomBpk, placeOfBirth);
Mockito.when(zmrClient.searchWithPersonIdentifier(null, randomPseudonym, DE))
- .thenReturn(zmrRegisterResult(randomRegisterResult(oldGivenName, randomBpk)));
+ .thenReturn(zmrRegisterResult(firstZmrResult));
Mockito.when(zmrClient.searchCountrySpecific(any(), any(), any()))
.thenThrow(new IllegalStateException("CountrySpecific search search should not be neccessary"));
Mockito.when(zmrClient.searchWithMds(any(), any(), any(), any(), any()))
.thenThrow(new IllegalStateException("MDS search should not be neccessary"));
Mockito.when(zmrClient.update(any(), any(), any()))
- .thenThrow(new IllegalStateException("ZMR update should not be neccessary"));
+ .thenReturn(zmrRegisterResult(firstZmrResult));
Mockito.when(ernpClient.searchWithPersonIdentifier(randomPseudonym, DE))
.thenReturn(emptyErnpRegisterResult());
@@ -213,17 +214,33 @@ public class InitialSearchTaskTest {
*
* @throws EidasSAuthenticationException
*/
- @Ignore
@Test
@DirtiesContext
public void singlePersonalIdMatchUpdateNecessary_Ernp() throws TaskExecutionException, EidasSAuthenticationException {
Mockito.when(zmrClient.searchWithPersonIdentifier(null, randomPseudonym, DE))
.thenReturn(emptyZmrRegisterResult());
-
+ Mockito.when(zmrClient.searchCountrySpecific(any(), any(), any()))
+ .thenThrow(new IllegalStateException("CountrySpecific search search should not be neccessary"));
+ Mockito.when(zmrClient.searchWithMds(any(), any(), any(), any(), any()))
+ .thenThrow(new IllegalStateException("MDS search should not be neccessary"));
+ Mockito.when(zmrClient.update(any(), any(), any()))
+ .thenThrow(new IllegalStateException("ZMR update should not be neccessary"));
+
String oldRandomGivenName = randomAlphabetic(10);
Mockito.when(ernpClient.searchWithPersonIdentifier(randomPseudonym, DE))
.thenReturn(ernpRegisterResult(randomRegisterResult(oldRandomGivenName, randomBpk)));
-
+ Mockito.when(ernpClient.searchCountrySpecific(any(), any()))
+ .thenThrow(new IllegalStateException("CountrySpecific search search should not be neccessary"));
+ Mockito.when(ernpClient.searchWithMds(any(), any(), any(), any()))
+ .thenThrow(new IllegalStateException("MDS search should not be neccessary"));
+ Mockito.when(ernpClient.update(any(), any()))
+ .thenReturn(ernpRegisterResult(RegisterResult.builder()
+ .bpk(randomBpk)
+ .dateOfBirth(randomBirthDate)
+ .givenName(randomGivenName)
+ .familyName(randomFamilyName)
+ .build()));
+
// execute test
task.execute(pendingReq, executionContext);
@@ -799,6 +816,18 @@ public class InitialSearchTaskTest {
}
@NotNull
+ private RegisterResult randomRegisterResult(String randomGivenName, String randomBpk, String placeOfBirth) {
+ return RegisterResult.builder()
+ .bpk(randomBpk)
+ .pseudonym(Collections.singletonList(randomPseudonym))
+ .givenName(randomGivenName)
+ .familyName(randomFamilyName)
+ .dateOfBirth(randomBirthDate)
+ .placeOfBirth(placeOfBirth)
+ .build();
+ }
+
+ @NotNull
private AuthenticationResponse buildDummyAuthResponseRandomPerson() throws URISyntaxException {
return buildDummyAuthResponse(randomGivenName, randomFamilyName, DE_ST + randomPseudonym, randomBirthDate);
}