aboutsummaryrefslogtreecommitdiff
path: root/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/AlternativeSearchTaskWithRegisterTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/AlternativeSearchTaskWithRegisterTest.java')
-rw-r--r--modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/AlternativeSearchTaskWithRegisterTest.java52
1 files changed, 15 insertions, 37 deletions
diff --git a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/AlternativeSearchTaskWithRegisterTest.java b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/AlternativeSearchTaskWithRegisterTest.java
index 3814c632..682db41e 100644
--- a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/AlternativeSearchTaskWithRegisterTest.java
+++ b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/AlternativeSearchTaskWithRegisterTest.java
@@ -27,7 +27,6 @@ import javax.xml.namespace.QName;
import org.apache.commons.lang3.RandomStringUtils;
import org.jetbrains.annotations.NotNull;
-import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Rule;
@@ -252,19 +251,17 @@ public class AlternativeSearchTaskWithRegisterTest {
Constants.DATA_FULL_EIDAS_RESPONSE_ALTERNATIVE,
buildDummyAuthResponse("XXXKlaus - Maria", "XXXvon Brandenburg",
"EE/AT/7cEYasdfsafsaf4CDVzNT4E7cjkU4VqForjUnit", "1994-12-31"));
-
-
+
// execute task
- TaskExecutionException exception = assertThrows(TaskExecutionException.class,
- () -> task.execute(pendingReq, executionContext));
+ task.execute(pendingReq, executionContext);
// validate state
- assertTrue("Wrong exception", (exception.getOriginalException() instanceof WorkflowException));
- assertEquals("wrong errorparam 1", "step11", ((EaafException) exception.getOriginalException()).getParams()[0]);
- assertTrue("Wrong flag 'step11'",
- ((WorkflowException) exception.getOriginalException()).isRequiresManualFix());
- assertEquals("wrong errorparam 1", "Country Code of alternative eIDAS authn not matching",
- ((EaafException) exception.getOriginalException()).getParams()[1]);
+ assertNotNull("find no eIDAS inbut data", MatchingTaskUtils.getInitialEidasData(pendingReq));
+ assertNull("final matching result", MatchingTaskUtils.getFinalMatchingResult(pendingReq));
+ assertEquals("wrong executionContextFlag 'alternative eIDAS result'", true,
+ executionContext.get(Constants.TRANSITION_TO_GENERATE_OTHER_LOGIN_METHOD_GUI_TASK));
+ assertEquals("matching failed flag", true, executionContext.get(Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED));
+ assertEquals("failed reason", "module.eidasauth.matching.26", executionContext.get(Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED_REASON));
}
@@ -301,16 +298,15 @@ public class AlternativeSearchTaskWithRegisterTest {
// execute task
- TaskExecutionException exception = assertThrows(TaskExecutionException.class,
- () -> task.execute(pendingReq, executionContext));
+ task.execute(pendingReq, executionContext);
// validate state
- assertTrue("Wrong exception", (exception.getOriginalException() instanceof WorkflowException));
- assertEquals("wrong errorparam 1", "step11", ((EaafException) exception.getOriginalException()).getParams()[0]);
- assertTrue("Wrong flag 'step11'",
- ((WorkflowException) exception.getOriginalException()).isRequiresManualFix());
- assertEquals("wrong errorparam 1", "MDS of alternative eIDAS authn does not match initial authn",
- ((EaafException) exception.getOriginalException()).getParams()[1]);
+ assertNotNull("find no eIDAS inbut data", MatchingTaskUtils.getInitialEidasData(pendingReq));
+ assertNull("final matching result", MatchingTaskUtils.getFinalMatchingResult(pendingReq));
+ assertEquals("wrong executionContextFlag 'alternative eIDAS result'", true,
+ executionContext.get(Constants.TRANSITION_TO_GENERATE_OTHER_LOGIN_METHOD_GUI_TASK));
+ assertEquals("matching failed flag", true, executionContext.get(Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED));
+ assertEquals("failed reason", "module.eidasauth.matching.26", executionContext.get(Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED_REASON));
}
@@ -887,8 +883,6 @@ public class AlternativeSearchTaskWithRegisterTest {
private void checkMatchingSuccessState(IRequest pendingReq, String bpk, String familyName, String givenName,
String birhday, String countryCode) {
- assertNull("Find intermediate matching data but matching should be finished",
- MatchingTaskUtils.getIntermediateMatchingResult(pendingReq));
assertNotNull("find no eIDAS inbut data", MatchingTaskUtils.getInitialEidasData(pendingReq));
MatchedPersonResult personInfo = MatchingTaskUtils.getFinalMatchingResult(pendingReq);
@@ -901,22 +895,6 @@ public class AlternativeSearchTaskWithRegisterTest {
}
- private void checkIntermediateResult(int resultSize) {
- Boolean transitionGUI = (Boolean) executionContext.get(Constants.TRANSITION_TO_GENERATE_OTHER_LOGIN_METHOD_GUI_TASK);
- Assert.assertTrue("Wrong transition", transitionGUI);
- Boolean transitionErnb = (Boolean) executionContext.get(Constants.TRANSITION_TO_CREATE_NEW_ERNP_ENTRY_TASK);
- Assert.assertNull("Wrong transition", transitionErnb);
-
- assertNotNull("find no eIDAS inbut data", MatchingTaskUtils.getInitialEidasData(pendingReq));
- assertNull("Find final matching data but no match sould be found",
- MatchingTaskUtils.getFinalMatchingResult(pendingReq));
-
- RegisterStatusResults result = MatchingTaskUtils.getIntermediateMatchingResult(pendingReq);
- assertNotNull("Find no intermediate matching data", result);
- assertEquals("wrong intermediate result size", resultSize, result.getResultCount());
-
- }
-
@NotNull
private AuthenticationResponse buildDummyAuthResponse(String givenName, String familyName, String identifier,
String dateOfBirth) throws URISyntaxException {