From 55d809e4b4df5c7ca9ba2bdf371f7f9376302ea8 Mon Sep 17 00:00:00 2001
From: Alexander Marsalek <amarsalek@iaik.tugraz.at>
Date: Thu, 7 Jan 2021 18:16:45 +0100
Subject: Resolve merge comments

---
 .../properties/status_messages_en.properties       |   3 +
 .../specific/modules/auth/eidas/v2/Constants.java  |   2 +-
 .../modules/auth/eidas/v2/dao/ErnbEidData.java     |   2 +-
 .../eidas/v2/dao/MergedRegisterSearchResult.java   |  57 ++-
 .../modules/auth/eidas/v2/dao/RegisterResult.java  |  61 +--
 .../modules/auth/eidas/v2/dao/SimpleEidasData.java |  27 +-
 .../auth/eidas/v2/ernb/DummyErnbClient.java        |  43 --
 .../modules/auth/eidas/v2/ernb/IErnbClient.java    |  20 -
 .../auth/eidas/v2/ernp/DummyErnpClient.java        |  66 ++++
 .../modules/auth/eidas/v2/ernp/IErnpClient.java    |  43 ++
 .../v2/exception/ManualFixNecessaryException.java  |   6 +-
 .../auth/eidas/v2/exception/WorkflowException.java |   6 +-
 .../CountrySpecificDetailSearchProcessor.java      |  61 +++
 .../handler/DeSpecificDetailSearchProcessor.java   |  35 +-
 .../ICountrySpecificDetailSearchProcessor.java     |  61 ---
 .../handler/ItSpecificDetailSearchProcessor.java   |  34 +-
 .../auth/eidas/v2/tasks/InitialSearchTask.java     | 188 ++++-----
 .../eidas/v2/tasks/ReceiveAuthnResponseTask.java   |   2 +-
 .../auth/eidas/v2/utils/EidasResponseUtils.java    | 107 ++---
 .../modules/auth/eidas/v2/zmr/DummyZmrClient.java  |  27 +-
 .../modules/auth/eidas/v2/zmr/IZmrClient.java      |  27 +-
 .../src/main/resources/eidas_v2_auth.beans.xml     |   2 +-
 .../v2/test/tasks/InitialSearchTaskFirstTest.java  | 438 +++++++++------------
 .../resources/SpringTest-context_tasks_test.xml    |   2 +-
 24 files changed, 694 insertions(+), 626 deletions(-)
 delete mode 100644 eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/ernb/DummyErnbClient.java
 delete mode 100644 eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/ernb/IErnbClient.java
 create mode 100644 eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/ernp/DummyErnpClient.java
 create mode 100644 eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/ernp/IErnpClient.java
 create mode 100644 eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/CountrySpecificDetailSearchProcessor.java
 delete mode 100644 eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/ICountrySpecificDetailSearchProcessor.java

diff --git a/connector/src/main/resources/properties/status_messages_en.properties b/connector/src/main/resources/properties/status_messages_en.properties
index 80228a47..c430fc90 100644
--- a/connector/src/main/resources/properties/status_messages_en.properties
+++ b/connector/src/main/resources/properties/status_messages_en.properties
@@ -6,6 +6,9 @@ eidas.04=Request contains no sessionToken. Authentication process stops
 eidas.05=Received eIDAS response-message is not valid. Reason: {0}
 eidas.06=LoA from eIDAS response-message {0} does not match to requested LoA
 eidas.07=eIDAS Response attribute-validation FAILED. Attribute:{0} Reason: {1}
+eidas.08=An unexpected error occurred.
+eidas.09=An error occurred while loading your data from official registers. Please contact the support.
+
 
 config.01=No configuration-file parameter found. Maybe Java SystemD parameter is missing
 config.03=Can not load configuration from path {0} (See logs for more details)
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/Constants.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/Constants.java
index 9104c55f..54f7f8fa 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/Constants.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/Constants.java
@@ -32,7 +32,7 @@ public class Constants {
   public static final String DATA_REQUESTED_LOA_LIST = "req_requestedLoA";
   public static final String DATA_REQUESTED_LOA_COMPERISON = "req_requestedLoAComperision";
   public static final String DATA_FULL_EIDAS_RESPONSE = "resp_fulleIDASResponse";
-  public static final String DATA_RESULT_MATCHING_BPK = "matching-result-bpk";//TODO?
+  public static final String DATA_RESULT_MATCHING_BPK = "matching-result-bpk";
 
   // templates for post-binding forwarding
   public static final String TEMPLATE_POST_FORWARD_NAME = "eidas_node_forward.html";
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/ErnbEidData.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/ErnbEidData.java
index 6c7eeb6b..b780d3e8 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/ErnbEidData.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/ErnbEidData.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2018 A-SIT Plus GmbH
+ * Copyright 2020 A-SIT Plus GmbH
  * AT-specific eIDAS Connector has been developed in a cooperation between EGIZ,
  * A-SIT Plus GmbH, A-SIT, and Graz University of Technology.
  *
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/MergedRegisterSearchResult.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/MergedRegisterSearchResult.java
index 056b0450..7703af2a 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/MergedRegisterSearchResult.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/MergedRegisterSearchResult.java
@@ -1,3 +1,26 @@
+/*
+ * Copyright 2020 A-SIT Plus GmbH
+ * AT-specific eIDAS Connector has been developed in a cooperation between EGIZ,
+ * A-SIT Plus GmbH, A-SIT, and Graz University of Technology.
+ *
+ * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "License");
+ * You may not use this work except in compliance with the License.
+ * You may obtain a copy of the License at:
+ * https://joinup.ec.europa.eu/news/understanding-eupl-v12
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text
+ * file for details on the various modules and licenses.
+ * The "NOTICE" text file is part of the distribution. Any derivative works
+ * that you distribute must include a readable copy of the "NOTICE" text file.
+ */
+
 package at.asitplus.eidas.specific.modules.auth.eidas.v2.dao;
 
 import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.WorkflowException;
@@ -5,28 +28,48 @@ import lombok.Data;
 
 import java.util.ArrayList;
 
-@Data public class MergedRegisterSearchResult {
+@Data
+public class MergedRegisterSearchResult {
+
+  final ArrayList<RegisterResult> resultsZmr;
+  final ArrayList<RegisterResult> resultsErnp;
 
-  ArrayList<RegisterResult> resultsZmr = new ArrayList<>();
-  ArrayList<RegisterResult> resultsErnb = new ArrayList<>();
+  public MergedRegisterSearchResult(ArrayList<RegisterResult> resultsZmr, ArrayList<RegisterResult> resultsErnp) {
+    this.resultsZmr = resultsZmr;
+    this.resultsErnp = resultsErnp;
+  }
 
   public int getResultCount() {
-    return resultsZmr.size() + resultsErnb.size();
+    return resultsZmr.size() + resultsErnp.size();
   }
 
   /**
-   * Verfies that there is only one match and retunrs the bpk.
+   * Verifies that there is only one match and returns the bpk.
+   *
    * @return bpk bpk of the match
    * @throws WorkflowException if multiple results have been found
    */
   public String getBpk() throws WorkflowException {
+    if (getResultCount() != 1) {
+      throw new WorkflowException("getResultCount() != 1");
+    }
+    return getResult().getBpk();
+  }
+
+  /**
+   * Returns the results, if there is exactly one, throws exception otherwise.
+   *
+   * @return The result
+   * @throws WorkflowException Results does not contain exactly one result
+   */
+  public RegisterResult getResult() throws WorkflowException {
     if (getResultCount() != 1) {
       throw new WorkflowException("getResultCount() != 1");
     }
     if (resultsZmr.size() == 1) {
-      return resultsZmr.get(0).getBpk();
+      return resultsZmr.get(0);
     } else {
-      return resultsErnb.get(0).getBpk();
+      return resultsErnp.get(0);
     }
   }
 }
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/RegisterResult.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/RegisterResult.java
index c92808a1..1cc36fe9 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/RegisterResult.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/RegisterResult.java
@@ -1,3 +1,26 @@
+/*
+ * Copyright 2020 A-SIT Plus GmbH
+ * AT-specific eIDAS Connector has been developed in a cooperation between EGIZ,
+ * A-SIT Plus GmbH, A-SIT, and Graz University of Technology.
+ *
+ * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "License");
+ * You may not use this work except in compliance with the License.
+ * You may obtain a copy of the License at:
+ * https://joinup.ec.europa.eu/news/understanding-eupl-v12
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text
+ * file for details on the various modules and licenses.
+ * The "NOTICE" text file is part of the distribution. Any derivative works
+ * that you distribute must include a readable copy of the "NOTICE" text file.
+ */
+
 package at.asitplus.eidas.specific.modules.auth.eidas.v2.dao;
 
 import at.gv.e_government.reference.namespace.persondata._20020228.PostalAddressType;
@@ -7,18 +30,18 @@ import lombok.Data;
 public class RegisterResult {
 
   // MDS
-  private String pseudonym = null;
-  private String givenName = null;
-  private String familyName = null;
-  private String dateOfBirth = null;
+  private String pseudonym;
+  private String givenName;
+  private String familyName;
+  private String dateOfBirth;
 
   // additional attributes
-  private String placeOfBirth = null;
-  private String birthName = null;
-  private String taxNumber = null;
-  private PostalAddressType address = null;
+  private String placeOfBirth;
+  private String birthName;
+  private String taxNumber;
+  private PostalAddressType address;
 
-  private String bpk = null;
+  private String bpk;
 
   /**
    * Register search result.
@@ -37,26 +60,6 @@ public class RegisterResult {
     this.dateOfBirth = dateOfBirth;
   }
 
-  /**
-   * Register search result.
-   *
-   * @param bpk          The bpk
-   * @param pseudonym    The pseudonym
-   * @param givenName    The givenName
-   * @param familyName   The familyName
-   * @param dateOfBirth  The dateOfBirth
-   * @param placeOfBirth The placeOfBirth
-   */
-  public RegisterResult(String bpk, String pseudonym, String givenName, String familyName, String dateOfBirth,
-                        String placeOfBirth) {
-    this.bpk = bpk;
-    this.pseudonym = pseudonym;
-    this.givenName = givenName;
-    this.familyName = familyName;
-    this.dateOfBirth = dateOfBirth;
-    this.placeOfBirth = placeOfBirth;
-  }
-
   /**
    * Register search result.
    *
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/SimpleEidasData.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/SimpleEidasData.java
index 674f5b48..57597122 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/SimpleEidasData.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/SimpleEidasData.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2018 A-SIT Plus GmbH
+ * Copyright 2020 A-SIT Plus GmbH
  * AT-specific eIDAS Connector has been developed in a cooperation between EGIZ,
  * A-SIT Plus GmbH, A-SIT, and Graz University of Technology.
  *
@@ -30,18 +30,18 @@ import lombok.Data;
 @Data
 public class SimpleEidasData {
 
-  private String citizenCountryCode = null;
+  private String citizenCountryCode;
 
   // MDS
-  private String pseudonym = null;
-  private String givenName = null;
-  private String familyName = null;
-  private String dateOfBirth = null;
+  private String pseudonym;
+  private String givenName;
+  private String familyName;
+  private String dateOfBirth;
 
   // additional attributes
-  private String placeOfBirth = null;
-  private String birthName = null;
-  private PostalAddressType address = null;
+  private String placeOfBirth;
+  private String birthName;
+  private PostalAddressType address;
   private String taxNumber;
 
   /**
@@ -51,14 +51,7 @@ public class SimpleEidasData {
    * @throws WorkflowException if multiple results have been found
    */
   public boolean equalsRegisterData(MergedRegisterSearchResult result) throws WorkflowException {
-    if (result.getResultCount() != 1) {
-      throw new WorkflowException("result.getResultCount() != 1");
-    }
-    if (result.getResultsErnb().size() == 1) {
-      return equalsRegisterData(result.getResultsErnb().get(0));
-    } else {
-      return equalsRegisterData(result.getResultsZmr().get(0));
-    }
+    return equalsRegisterData(result.getResult());
   }
 
   private boolean equalsRegisterData(RegisterResult result) {
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/ernb/DummyErnbClient.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/ernb/DummyErnbClient.java
deleted file mode 100644
index 2d2fa76d..00000000
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/ernb/DummyErnbClient.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package at.asitplus.eidas.specific.modules.auth.eidas.v2.ernb;
-
-import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.RegisterResult;
-import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.SimpleEidasData;
-import org.springframework.stereotype.Service;
-
-import java.util.ArrayList;
-
-@Service("ErnbClientForeIDAS")
-public class DummyErnbClient implements IErnbClient {
-
-  @Override
-  public ArrayList<RegisterResult> searchWithPersonIdentifer(String personIdentifer) {
-    return resultEmpty();
-  }
-
-  @Override
-  public ArrayList<RegisterResult> searchWithMds(String givenName, String familyName, String dateOfBirth) {
-    return resultEmpty();//TODO will I only receive matches where all three values match perfectly?
-  }
-
-  @Override
-  public ArrayList<RegisterResult> searchDeSpecific(String givenName, String familyName, String dateOfBirth,
-                                                    String birthPlace, String birthName) {
-    return resultEmpty();//TODO
-  }
-
-  @Override
-  public ArrayList<RegisterResult> searchItSpecific(String txNumber) {
-    return resultEmpty();//TODO
-  }
-
-  @Override
-  public void update(RegisterResult registerResult, SimpleEidasData eidData) {
-    //TODO
-  }
-
-  private ArrayList<RegisterResult> resultEmpty() {
-    return new ArrayList<RegisterResult>();//Nobody found
-  }
-
-
-}
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/ernb/IErnbClient.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/ernb/IErnbClient.java
deleted file mode 100644
index cda4c426..00000000
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/ernb/IErnbClient.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package at.asitplus.eidas.specific.modules.auth.eidas.v2.ernb;
-
-import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.RegisterResult;
-import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.SimpleEidasData;
-
-import java.util.ArrayList;
-
-public interface IErnbClient {
-
-  ArrayList<RegisterResult> searchWithPersonIdentifer(String personIdentifer);
-
-  ArrayList<RegisterResult> searchWithMds(String givenName, String familyName, String dateOfBirth);
-
-  ArrayList<RegisterResult> searchDeSpecific(String givenName, String familyName, String dateOfBirth,
-                                             String birthPlace, String birthName);
-
-  ArrayList<RegisterResult> searchItSpecific(String txNumber);
-
-  void update(RegisterResult registerResult, SimpleEidasData eidData);
-}
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/ernp/DummyErnpClient.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/ernp/DummyErnpClient.java
new file mode 100644
index 00000000..3b49ab95
--- /dev/null
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/ernp/DummyErnpClient.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2020 A-SIT Plus GmbH
+ * AT-specific eIDAS Connector has been developed in a cooperation between EGIZ,
+ * A-SIT Plus GmbH, A-SIT, and Graz University of Technology.
+ *
+ * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "License");
+ * You may not use this work except in compliance with the License.
+ * You may obtain a copy of the License at:
+ * https://joinup.ec.europa.eu/news/understanding-eupl-v12
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text
+ * file for details on the various modules and licenses.
+ * The "NOTICE" text file is part of the distribution. Any derivative works
+ * that you distribute must include a readable copy of the "NOTICE" text file.
+ */
+
+package at.asitplus.eidas.specific.modules.auth.eidas.v2.ernp;
+
+import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.RegisterResult;
+import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.SimpleEidasData;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+
+@Service("ErnbClientForeIDAS")
+public class DummyErnpClient implements IErnpClient {
+
+  @Override
+  public ArrayList<RegisterResult> searchWithPersonIdentifier(String personIdentifier) {
+    return resultEmpty();
+  }
+
+  @Override
+  public ArrayList<RegisterResult> searchWithMds(String givenName, String familyName, String dateOfBirth) {
+    return resultEmpty();//TODO will I only receive matches where all three values match perfectly?
+  }
+
+  @Override
+  public ArrayList<RegisterResult> searchDeSpecific(String givenName, String familyName, String dateOfBirth,
+                                                    String birthPlace, String birthName) {
+    return resultEmpty();//TODO
+  }
+
+  @Override
+  public ArrayList<RegisterResult> searchItSpecific(String taxNumber) {
+    return resultEmpty();//TODO
+  }
+
+  @Override
+  public void update(RegisterResult registerResult, SimpleEidasData eidData) {
+    //TODO
+  }
+
+  private ArrayList<RegisterResult> resultEmpty() {
+    return new ArrayList<RegisterResult>();//Nobody found
+  }
+
+
+}
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/ernp/IErnpClient.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/ernp/IErnpClient.java
new file mode 100644
index 00000000..01ac88fb
--- /dev/null
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/ernp/IErnpClient.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2020 A-SIT Plus GmbH
+ * AT-specific eIDAS Connector has been developed in a cooperation between EGIZ,
+ * A-SIT Plus GmbH, A-SIT, and Graz University of Technology.
+ *
+ * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "License");
+ * You may not use this work except in compliance with the License.
+ * You may obtain a copy of the License at:
+ * https://joinup.ec.europa.eu/news/understanding-eupl-v12
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text
+ * file for details on the various modules and licenses.
+ * The "NOTICE" text file is part of the distribution. Any derivative works
+ * that you distribute must include a readable copy of the "NOTICE" text file.
+ */
+
+package at.asitplus.eidas.specific.modules.auth.eidas.v2.ernp;
+
+import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.RegisterResult;
+import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.SimpleEidasData;
+
+import java.util.ArrayList;
+
+public interface IErnpClient {
+
+  ArrayList<RegisterResult> searchWithPersonIdentifier(String personIdentifier);
+
+  ArrayList<RegisterResult> searchWithMds(String givenName, String familyName, String dateOfBirth);
+
+  ArrayList<RegisterResult> searchDeSpecific(String givenName, String familyName, String dateOfBirth,
+                                             String birthPlace, String birthName);
+
+  ArrayList<RegisterResult> searchItSpecific(String taxNumber);
+
+  void update(RegisterResult registerResult, SimpleEidasData eidData);
+}
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/exception/ManualFixNecessaryException.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/exception/ManualFixNecessaryException.java
index c22e8135..2fecaa6b 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/exception/ManualFixNecessaryException.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/exception/ManualFixNecessaryException.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2018 A-SIT Plus GmbH
+ * Copyright 2020 A-SIT Plus GmbH
  * AT-specific eIDAS Connector has been developed in a cooperation between EGIZ,
  * A-SIT Plus GmbH, A-SIT, and Graz University of Technology.
  *
@@ -29,10 +29,10 @@ public class ManualFixNecessaryException extends EidasSAuthenticationException {
   private static final long serialVersionUID = 1L;
 
   public ManualFixNecessaryException(String personIdentifier) {
-    super("eidas.00", new Object[] { personIdentifier });//TODO "eidas.00"
+    super("eidas.09", new Object[] { personIdentifier });
   }
 
   public ManualFixNecessaryException(SimpleEidasData eidData) {
-    super("eidas.00", new Object[] { eidData.getPseudonym() });//TODO "eidas.00"   => what info to pass???
+    super("eidas.09", new Object[] { eidData.getPseudonym() });//TODO what info to pass???
   }
 }
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/exception/WorkflowException.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/exception/WorkflowException.java
index aa879bcc..b6f3309b 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/exception/WorkflowException.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/exception/WorkflowException.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2018 A-SIT Plus GmbH
+ * Copyright 2020 A-SIT Plus GmbH
  * AT-specific eIDAS Connector has been developed in a cooperation between EGIZ,
  * A-SIT Plus GmbH, A-SIT, and Graz University of Technology.
  *
@@ -19,7 +19,7 @@
  * file for details on the various modules and licenses.
  * The "NOTICE" text file is part of the distribution. Any derivative works
  * that you distribute must include a readable copy of the "NOTICE" text file.
-*/
+ */
 
 package at.asitplus.eidas.specific.modules.auth.eidas.v2.exception;
 
@@ -27,7 +27,7 @@ public class WorkflowException extends EidasSAuthenticationException {
   private static final long serialVersionUID = 1L;
 
   public WorkflowException(String data) {
-    super("eidas.00", new Object[] { data });
+    super("eidas.08", new Object[]{data});
   }
 
 }
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/CountrySpecificDetailSearchProcessor.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/CountrySpecificDetailSearchProcessor.java
new file mode 100644
index 00000000..c5b3b231
--- /dev/null
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/CountrySpecificDetailSearchProcessor.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2020 A-SIT Plus GmbH
+ * AT-specific eIDAS Connector has been developed in a cooperation between EGIZ,
+ * A-SIT Plus GmbH, A-SIT, and Graz University of Technology.
+ *
+ * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "License");
+ * You may not use this work except in compliance with the License.
+ * You may obtain a copy of the License at:
+ * https://joinup.ec.europa.eu/news/understanding-eupl-v12
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text
+ * file for details on the various modules and licenses.
+ * The "NOTICE" text file is part of the distribution. Any derivative works
+ * that you distribute must include a readable copy of the "NOTICE" text file.
+ */
+
+package at.asitplus.eidas.specific.modules.auth.eidas.v2.handler;
+
+import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.MergedRegisterSearchResult;
+import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.SimpleEidasData;
+import at.asitplus.eidas.specific.modules.auth.eidas.v2.ernp.IErnpClient;
+import at.asitplus.eidas.specific.modules.auth.eidas.v2.zmr.IZmrClient;
+
+public abstract class CountrySpecificDetailSearchProcessor {
+
+  protected IErnpClient ernbClient;
+  protected IZmrClient zmrClient;
+
+  public CountrySpecificDetailSearchProcessor(IErnpClient ernbClient, IZmrClient zmrClient) {
+    this.ernbClient = ernbClient;
+    this.zmrClient = zmrClient;
+  }
+
+  /**
+   * Get a friendlyName of this post-processor implementation.
+   *
+   * @return
+   */
+  public String getName() {
+    return this.getClass().getName();
+  }
+
+  /**
+   * Check if this postProcessor is sensitive for a specific country.
+   *
+   * @param countryCode of the eID data that should be processed
+   * @param eidData     eID data
+   * @return true if this implementation can handle the country, otherwise false
+   */
+  public abstract boolean canHandle(String countryCode, SimpleEidasData eidData);
+
+  public abstract MergedRegisterSearchResult search(SimpleEidasData eidData);
+
+}
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/DeSpecificDetailSearchProcessor.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/DeSpecificDetailSearchProcessor.java
index e8cb7a1a..a29725c8 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/DeSpecificDetailSearchProcessor.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/DeSpecificDetailSearchProcessor.java
@@ -1,17 +1,40 @@
+/*
+ * Copyright 2020 A-SIT Plus GmbH
+ * AT-specific eIDAS Connector has been developed in a cooperation between EGIZ,
+ * A-SIT Plus GmbH, A-SIT, and Graz University of Technology.
+ *
+ * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "License");
+ * You may not use this work except in compliance with the License.
+ * You may obtain a copy of the License at:
+ * https://joinup.ec.europa.eu/news/understanding-eupl-v12
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text
+ * file for details on the various modules and licenses.
+ * The "NOTICE" text file is part of the distribution. Any derivative works
+ * that you distribute must include a readable copy of the "NOTICE" text file.
+ */
+
 package at.asitplus.eidas.specific.modules.auth.eidas.v2.handler;
 
 import at.asitplus.eidas.specific.modules.auth.eidas.v2.Constants;
 import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.MergedRegisterSearchResult;
 import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.RegisterResult;
 import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.SimpleEidasData;
-import at.asitplus.eidas.specific.modules.auth.eidas.v2.ernb.IErnbClient;
+import at.asitplus.eidas.specific.modules.auth.eidas.v2.ernp.IErnpClient;
 import at.asitplus.eidas.specific.modules.auth.eidas.v2.zmr.IZmrClient;
 
 import java.util.ArrayList;
 
-public class DeSpecificDetailSearchProcessor extends ICountrySpecificDetailSearchProcessor {
+public class DeSpecificDetailSearchProcessor extends CountrySpecificDetailSearchProcessor {
 
-  public DeSpecificDetailSearchProcessor(IErnbClient ernbClient, IZmrClient zmrClient) {
+  public DeSpecificDetailSearchProcessor(IErnpClient ernbClient, IZmrClient zmrClient) {
     super(ernbClient, zmrClient);
   }
 
@@ -31,17 +54,17 @@ public class DeSpecificDetailSearchProcessor extends ICountrySpecificDetailSearc
 
   @Override
   public MergedRegisterSearchResult search(SimpleEidasData eidData) {
-    MergedRegisterSearchResult searchResult = new MergedRegisterSearchResult();
+
 
     ArrayList<RegisterResult> resultsZmr =
         zmrClient.searchDeSpecific(eidData.getGivenName(), eidData.getFamilyName(), eidData.getDateOfBirth(),
             eidData.getPlaceOfBirth(), eidData.getBirthName());
-    searchResult.setResultsZmr(resultsZmr);
 
     ArrayList<RegisterResult> resultsErnb =
         ernbClient.searchDeSpecific(eidData.getGivenName(), eidData.getFamilyName(), eidData.getDateOfBirth(),
             eidData.getPlaceOfBirth(), eidData.getBirthName());
-    searchResult.setResultsErnb(resultsErnb);
+
+    MergedRegisterSearchResult searchResult = new MergedRegisterSearchResult(resultsZmr, resultsErnb);
     return searchResult;
   }
 }
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/ICountrySpecificDetailSearchProcessor.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/ICountrySpecificDetailSearchProcessor.java
deleted file mode 100644
index 6a2b2c0a..00000000
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/ICountrySpecificDetailSearchProcessor.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright 2018 A-SIT Plus GmbH
- * AT-specific eIDAS Connector has been developed in a cooperation between EGIZ,
- * A-SIT Plus GmbH, A-SIT, and Graz University of Technology.
- *
- * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by
- * the European Commission - subsequent versions of the EUPL (the "License");
- * You may not use this work except in compliance with the License.
- * You may obtain a copy of the License at:
- * https://joinup.ec.europa.eu/news/understanding-eupl-v12
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * This product combines work with different licenses. See the "NOTICE" text
- * file for details on the various modules and licenses.
- * The "NOTICE" text file is part of the distribution. Any derivative works
- * that you distribute must include a readable copy of the "NOTICE" text file.
- */
-
-package at.asitplus.eidas.specific.modules.auth.eidas.v2.handler;
-
-import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.MergedRegisterSearchResult;
-import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.SimpleEidasData;
-import at.asitplus.eidas.specific.modules.auth.eidas.v2.ernb.IErnbClient;
-import at.asitplus.eidas.specific.modules.auth.eidas.v2.zmr.IZmrClient;
-
-public abstract class ICountrySpecificDetailSearchProcessor {
-
-  protected IErnbClient ernbClient;
-  protected IZmrClient zmrClient;
-
-  public ICountrySpecificDetailSearchProcessor(IErnbClient ernbClient, IZmrClient zmrClient) {
-    this.ernbClient = ernbClient;
-    this.zmrClient = zmrClient;
-  }
-
-  /**
-   * Get a friendlyName of this post-processor implementation.
-   *
-   * @return
-   */
-  public String getName() {
-    return this.getClass().getName();
-  }
-
-  /**
-   * Check if this postProcessor is sensitive for a specific country.
-   *
-   * @param countryCode of the eID data that should be processed
-   * @param eidData     eID data
-   * @return true if this implementation can handle the country, otherwise false
-   */
-  public abstract boolean canHandle(String countryCode, SimpleEidasData eidData);
-
-  public abstract MergedRegisterSearchResult search(SimpleEidasData eidData);
-
-}
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/ItSpecificDetailSearchProcessor.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/ItSpecificDetailSearchProcessor.java
index a94a67b3..e730066d 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/ItSpecificDetailSearchProcessor.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/ItSpecificDetailSearchProcessor.java
@@ -1,17 +1,40 @@
+/*
+ * Copyright 2020 A-SIT Plus GmbH
+ * AT-specific eIDAS Connector has been developed in a cooperation between EGIZ,
+ * A-SIT Plus GmbH, A-SIT, and Graz University of Technology.
+ *
+ * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "License");
+ * You may not use this work except in compliance with the License.
+ * You may obtain a copy of the License at:
+ * https://joinup.ec.europa.eu/news/understanding-eupl-v12
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text
+ * file for details on the various modules and licenses.
+ * The "NOTICE" text file is part of the distribution. Any derivative works
+ * that you distribute must include a readable copy of the "NOTICE" text file.
+ */
+
 package at.asitplus.eidas.specific.modules.auth.eidas.v2.handler;
 
 import at.asitplus.eidas.specific.modules.auth.eidas.v2.Constants;
 import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.MergedRegisterSearchResult;
 import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.RegisterResult;
 import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.SimpleEidasData;
-import at.asitplus.eidas.specific.modules.auth.eidas.v2.ernb.IErnbClient;
+import at.asitplus.eidas.specific.modules.auth.eidas.v2.ernp.IErnpClient;
 import at.asitplus.eidas.specific.modules.auth.eidas.v2.zmr.IZmrClient;
 
 import java.util.ArrayList;
 
-public class ItSpecificDetailSearchProcessor extends ICountrySpecificDetailSearchProcessor {
+public class ItSpecificDetailSearchProcessor extends CountrySpecificDetailSearchProcessor {
 
-  public ItSpecificDetailSearchProcessor(IErnbClient ernbClient, IZmrClient zmrClient) {
+  public ItSpecificDetailSearchProcessor(IErnpClient ernbClient, IZmrClient zmrClient) {
     super(ernbClient, zmrClient);
   }
 
@@ -28,15 +51,14 @@ public class ItSpecificDetailSearchProcessor extends ICountrySpecificDetailSearc
 
   @Override
   public MergedRegisterSearchResult search(SimpleEidasData eidData) {
-    MergedRegisterSearchResult searchResult = new MergedRegisterSearchResult();
 
     ArrayList<RegisterResult> resultsZmr =
         zmrClient.searchItSpecific(eidData.getTaxNumber());
-    searchResult.setResultsZmr(resultsZmr);
 
     ArrayList<RegisterResult> resultsErnb =
         ernbClient.searchItSpecific(eidData.getTaxNumber());
-    searchResult.setResultsErnb(resultsErnb);
+
+    MergedRegisterSearchResult searchResult = new MergedRegisterSearchResult(resultsZmr, resultsErnb);
     return searchResult;
   }
 }
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/InitialSearchTask.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/InitialSearchTask.java
index a87be6c5..ba05ef0d 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/InitialSearchTask.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/InitialSearchTask.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2018 A-SIT Plus GmbH
+ * Copyright 2020 A-SIT Plus GmbH
  * AT-specific eIDAS Connector has been developed in a cooperation between EGIZ,
  * A-SIT Plus GmbH, A-SIT, and Graz University of Technology.
  *
@@ -27,12 +27,11 @@ import at.asitplus.eidas.specific.modules.auth.eidas.v2.Constants;
 import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.MergedRegisterSearchResult;
 import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.RegisterResult;
 import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.SimpleEidasData;
-import at.asitplus.eidas.specific.modules.auth.eidas.v2.ernb.IErnbClient;
-import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.EidPostProcessingException;
+import at.asitplus.eidas.specific.modules.auth.eidas.v2.ernp.IErnpClient;
 import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.EidasAttributeException;
 import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.ManualFixNecessaryException;
 import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.WorkflowException;
-import at.asitplus.eidas.specific.modules.auth.eidas.v2.handler.ICountrySpecificDetailSearchProcessor;
+import at.asitplus.eidas.specific.modules.auth.eidas.v2.handler.CountrySpecificDetailSearchProcessor;
 import at.asitplus.eidas.specific.modules.auth.eidas.v2.utils.EidasResponseUtils;
 import at.asitplus.eidas.specific.modules.auth.eidas.v2.zmr.IZmrClient;
 import at.gv.egiz.eaaf.core.api.idp.process.ExecutionContext;
@@ -59,29 +58,32 @@ import java.util.List;
 import java.util.Map;
 
 /**
- * Task that searches ErnB and ZMR before adding person to SZR.
+ * Task that searches ErnP and ZMR before adding person to SZR.
  *
- * @author tlenz
+ * @author amarsalek
  */
 @Slf4j
 @Component("InitialSearchTask")
-// NOTE: General: Please rebase git commit and squash them where useful, i.e. "remove unused import" should
-//       not be a separate commit.
 public class InitialSearchTask extends AbstractAuthServletTask {
 
-  private List<ICountrySpecificDetailSearchProcessor> handlers = new ArrayList<>();
+  private final List<CountrySpecificDetailSearchProcessor> handlers;
+  private final IErnpClient ernpClient;
+  private final IZmrClient zmrClient;
 
-  private IErnbClient ernbClient;
-  private IZmrClient zmrClient;
-
-  /*
-   * (non-Javadoc)
-   *
-   * @see at.gv.egovernment.moa.id.process.springweb.MoaIdTask#execute(at.gv.
-   * egovernment.moa.id.process.api.ExecutionContext,
-   * javax.servlet.http.HttpServletRequest,
-   * javax.servlet.http.HttpServletResponse)
+  /**
+   * Constructor.
+   * @param handlers List of countrySpecificSearchProcessors
+   * @param ernpClient Ernp client
+   * @param zmrClient ZMR client
    */
+  public InitialSearchTask(List<CountrySpecificDetailSearchProcessor> handlers, IErnpClient ernpClient,
+                           IZmrClient zmrClient) {
+    this.ernpClient = ernpClient;
+    this.zmrClient = zmrClient;
+    this.handlers = handlers;
+    log.info("# " + handlers.size() + " country specific detail search services are registered");
+  }
+
   @Override
   public void execute(ExecutionContext executionContext, HttpServletRequest request, HttpServletResponse response)
       throws TaskExecutionException {
@@ -90,7 +92,6 @@ public class InitialSearchTask extends AbstractAuthServletTask {
       final ILightResponse eidasResponse = authProcessData
           .getGenericDataFromSession(Constants.DATA_FULL_EIDAS_RESPONSE, ILightResponse.class);
 
-      // post-process eIDAS attributes
       final SimpleEidasData eidData = convertSimpleMapToSimpleData(convertEidasAttrToSimpleMap(
           eidasResponse.getAttributes().getAttributeMap()));
 
@@ -103,10 +104,11 @@ public class InitialSearchTask extends AbstractAuthServletTask {
   }
 
   private String step2RegisterSearchWithPersonidentifier(SimpleEidasData eidData) throws TaskExecutionException {
+    log.trace("Starting step2RegisterSearchWithPersonidentifier");
     String personIdentifier = eidData.getPseudonym();
     MergedRegisterSearchResult result = searchInZmrAndErnp(personIdentifier);
     if (result.getResultCount() == 0) {
-      return step5CheckCountrySpecificSearchPossible(result, eidData);
+      return step5CheckAndPerformCountrySpecificSearchIfPossible(result, eidData);
     } else if (result.getResultCount() == 1) {
       return step3CheckRegisterUpdateNecessary(result, eidData);
     }
@@ -114,46 +116,9 @@ public class InitialSearchTask extends AbstractAuthServletTask {
         new ManualFixNecessaryException(personIdentifier));
   }
 
-  private SimpleEidasData convertSimpleMapToSimpleData(Map<String, Object> eidasAttrMap)
-      throws EidasAttributeException, EidPostProcessingException {
-    SimpleEidasData simpleEidasData = new SimpleEidasData();
-
-    final Object eIdentifierObj = eidasAttrMap.get(Constants.eIDAS_ATTR_PERSONALIDENTIFIER);
-    final Triple<String, String, String> eIdentifier =
-        EidasResponseUtils.parseEidasPersonalIdentifier((String) eIdentifierObj);
-    simpleEidasData.setCitizenCountryCode(eIdentifier.getFirst());
-
-    // MDS attributes
-    simpleEidasData.setPseudonym(EidasResponseUtils.processPseudonym(
-        eidasAttrMap.get(Constants.eIDAS_ATTR_PERSONALIDENTIFIER)));
-    simpleEidasData.setFamilyName(EidasResponseUtils.processFamilyName(
-        eidasAttrMap.get(Constants.eIDAS_ATTR_CURRENTFAMILYNAME)));
-    simpleEidasData.setGivenName(EidasResponseUtils.processGivenName(
-        eidasAttrMap.get(Constants.eIDAS_ATTR_CURRENTGIVENNAME)));
-    simpleEidasData.setDateOfBirth(EidasResponseUtils.processDateOfBirthToString(
-        eidasAttrMap.get(Constants.eIDAS_ATTR_DATEOFBIRTH)));
-
-    // additional attributes
-    simpleEidasData.setPlaceOfBirth(EidasResponseUtils.processPlaceOfBirth(
-        eidasAttrMap.get(Constants.eIDAS_ATTR_PLACEOFBIRTH)));
-    simpleEidasData.setBirthName(EidasResponseUtils.processBirthName(
-        eidasAttrMap.get(Constants.eIDAS_ATTR_BIRTHNAME)));
-    simpleEidasData.setAddress(EidasResponseUtils.processAddress(
-        eidasAttrMap.get(Constants.eIDAS_ATTR_CURRENTADDRESS)));
-
-    if (eidasAttrMap.containsKey(Constants.eIDAS_ATTR_TAXREFERENCE)) {
-      simpleEidasData.setTaxNumber(EidasResponseUtils.processTaxReference(
-          eidasAttrMap.get(Constants.eIDAS_ATTR_TAXREFERENCE)));
-    }
-
-    //TODO other additional attributes
-    return simpleEidasData;
-  }
-
   private String step3CheckRegisterUpdateNecessary(MergedRegisterSearchResult result, SimpleEidasData eidData)
       throws TaskExecutionException {
-    //check if data from eidas authentication matches with data from register
-    log.debug("Compare " + result + " with " + eidData);
+    log.trace("Starting step3CheckRegisterUpdateNecessary");
     try {
       if (eidData.equalsRegisterData(result)) {
         //No update necessary, just return bpk
@@ -168,18 +133,19 @@ public class InitialSearchTask extends AbstractAuthServletTask {
 
   private String step4UpdateRegisterData(MergedRegisterSearchResult result,
                                          SimpleEidasData eidData) throws WorkflowException {
+    log.trace("Starting step4UpdateRegisterData");
     log.debug("Update " + result + " with " + eidData);
     //TODO wann rechtlich möglich?
 
     return result.getBpk();
   }
 
-  private String step5CheckCountrySpecificSearchPossible(MergedRegisterSearchResult result, SimpleEidasData eidData)
-      throws TaskExecutionException {
+  private String step5CheckAndPerformCountrySpecificSearchIfPossible(
+      MergedRegisterSearchResult result, SimpleEidasData eidData) throws TaskExecutionException {
+    log.trace("Starting step5CheckAndPerformCountrySpecificSearchIfPossible");
     String citizenCountry = eidData.getCitizenCountryCode();
-    ICountrySpecificDetailSearchProcessor foundHandler = null;
-    for (final ICountrySpecificDetailSearchProcessor el : handlers) {
-      //5 check if country specific search is possible
+    CountrySpecificDetailSearchProcessor foundHandler = null;
+    for (final CountrySpecificDetailSearchProcessor el : handlers) {
       if (el.canHandle(citizenCountry, eidData)) {
         log.debug("Found suitable country specific search handler for " + citizenCountry
             + " by using: " + el.getName());
@@ -188,18 +154,16 @@ public class InitialSearchTask extends AbstractAuthServletTask {
       }
     }
     if (foundHandler == null) {
-      //MDS search
       return step8RegisterSearchWithMds(result, eidData);
     } else {
-      //country specific search
       return step6CountrySpecificSearch(foundHandler, result, eidData);
     }
   }
 
-  private String step6CountrySpecificSearch(ICountrySpecificDetailSearchProcessor countrySpecificDetailSearchProcessor,
+  private String step6CountrySpecificSearch(CountrySpecificDetailSearchProcessor countrySpecificDetailSearchProcessor,
                                             MergedRegisterSearchResult initialSearchResult, SimpleEidasData eidData)
       throws TaskExecutionException {
-    //6 country specific search
+    log.trace("Starting step6CountrySpecificSearch");
     MergedRegisterSearchResult countrySpecificDetailSearchResult =
         countrySpecificDetailSearchProcessor.search(eidData);
 
@@ -208,7 +172,7 @@ public class InitialSearchTask extends AbstractAuthServletTask {
         return step8RegisterSearchWithMds(initialSearchResult, eidData);
       case 1:
         return step7aKittProcess(initialSearchResult, countrySpecificDetailSearchResult, eidData);
-      default://should not happen
+      default:
         throw new TaskExecutionException(pendingReq, "Detail search - Kitt Process necessary.",
             new ManualFixNecessaryException(eidData));
     }
@@ -217,8 +181,7 @@ public class InitialSearchTask extends AbstractAuthServletTask {
   private String step7aKittProcess(MergedRegisterSearchResult initialSearchResult,
                                    MergedRegisterSearchResult countrySpecificDetailSearchResult,
                                    SimpleEidasData eidData) throws TaskExecutionException {
-    //Automerge data
-    log.debug("Automerge " + initialSearchResult + " with " + eidData + " " + countrySpecificDetailSearchResult);
+    log.trace("Starting step7aKittProcess");
     try {
       if (initialSearchResult.getResultCount() != 0) {
         throw new WorkflowException("initialSearchResult.getResultCount() != 0");
@@ -227,14 +190,11 @@ public class InitialSearchTask extends AbstractAuthServletTask {
         throw new WorkflowException("countrySpecificDetailSearchResult.getResultCount() != 1");
       }
       if (countrySpecificDetailSearchResult.getResultsZmr().size() == 1) {
-        //update ZMR
         zmrClient.update(countrySpecificDetailSearchResult.getResultsZmr().get(0), eidData);
       }
-      if (countrySpecificDetailSearchResult.getResultsErnb().size() == 1) {
-        //update ErnB
-        ernbClient.update(countrySpecificDetailSearchResult.getResultsErnb().get(0), eidData);
+      if (countrySpecificDetailSearchResult.getResultsErnp().size() == 1) {
+        ernpClient.update(countrySpecificDetailSearchResult.getResultsErnp().get(0), eidData);
       }
-
       String bpK = countrySpecificDetailSearchResult.getBpk();
       return bpK;
     } catch (WorkflowException e) {
@@ -244,35 +204,70 @@ public class InitialSearchTask extends AbstractAuthServletTask {
 
   private String step8RegisterSearchWithMds(MergedRegisterSearchResult initialSearchResult,
                                             SimpleEidasData eidData) {
-    MergedRegisterSearchResult mdsSearchResult = new MergedRegisterSearchResult();
-
+    log.trace("Starting step8RegisterSearchWithMds");
     ArrayList<RegisterResult> resultsZmr =
         zmrClient.searchWithMds(eidData.getGivenName(), eidData.getFamilyName(), eidData.getDateOfBirth());
-    mdsSearchResult.setResultsZmr(resultsZmr);
 
-    ArrayList<RegisterResult> resultsErnb =
-        ernbClient.searchWithMds(eidData.getGivenName(), eidData.getFamilyName(), eidData.getDateOfBirth());
-    mdsSearchResult.setResultsErnb(resultsErnb);
+    ArrayList<RegisterResult> resultsErnp =
+        ernpClient.searchWithMds(eidData.getGivenName(), eidData.getFamilyName(), eidData.getDateOfBirth());
 
+    MergedRegisterSearchResult mdsSearchResult = new MergedRegisterSearchResult(resultsZmr, resultsErnp);
     log.debug("Automerge " + initialSearchResult + " with " + eidData + " " + mdsSearchResult);
     //TODO implement next phase and return correct value
     return "TODO-Temporary-Endnode-105";
   }
 
   private MergedRegisterSearchResult searchInZmrAndErnp(String personIdentifier) {
-    MergedRegisterSearchResult initialSearchResult = new MergedRegisterSearchResult();
 
     ArrayList<RegisterResult> resultsZmr =
-        zmrClient.searchWithPersonIdentifer(personIdentifier);
-    initialSearchResult.setResultsZmr(resultsZmr);
+        zmrClient.searchWithPersonIdentifier(personIdentifier);
 
-    ArrayList<RegisterResult> resultsErnb =
-        ernbClient.searchWithPersonIdentifer(personIdentifier);
-    initialSearchResult.setResultsErnb(resultsErnb);
+    ArrayList<RegisterResult> resultsErnp =
+        ernpClient.searchWithPersonIdentifier(personIdentifier);
 
+    MergedRegisterSearchResult initialSearchResult = new MergedRegisterSearchResult(resultsZmr, resultsErnp);
     return initialSearchResult;
   }
 
+  private SimpleEidasData convertSimpleMapToSimpleData(Map<String, Object> eidasAttrMap)
+      throws EidasAttributeException {
+    SimpleEidasData simpleEidasData = new SimpleEidasData();
+
+    final Object eIdentifierObj = eidasAttrMap.get(Constants.eIDAS_ATTR_PERSONALIDENTIFIER);
+    final Triple<String, String, String> eIdentifier =
+        EidasResponseUtils.parseEidasPersonalIdentifier((String) eIdentifierObj);
+    if (eIdentifier == null) {
+      throw new EidasAttributeException("Error processing eIdentifier");
+    }
+    simpleEidasData.setCitizenCountryCode(eIdentifier.getFirst());
+
+    // MDS attributes
+    simpleEidasData.setPseudonym(EidasResponseUtils.processPseudonym(
+        eidasAttrMap.get(Constants.eIDAS_ATTR_PERSONALIDENTIFIER)));
+    simpleEidasData.setFamilyName(EidasResponseUtils.processFamilyName(
+        eidasAttrMap.get(Constants.eIDAS_ATTR_CURRENTFAMILYNAME)));
+    simpleEidasData.setGivenName(EidasResponseUtils.processGivenName(
+        eidasAttrMap.get(Constants.eIDAS_ATTR_CURRENTGIVENNAME)));
+    simpleEidasData.setDateOfBirth(EidasResponseUtils.processDateOfBirthToString(
+        eidasAttrMap.get(Constants.eIDAS_ATTR_DATEOFBIRTH)));
+
+    // additional attributes
+    simpleEidasData.setPlaceOfBirth(EidasResponseUtils.processPlaceOfBirth(
+        eidasAttrMap.get(Constants.eIDAS_ATTR_PLACEOFBIRTH)));
+    simpleEidasData.setBirthName(EidasResponseUtils.processBirthName(
+        eidasAttrMap.get(Constants.eIDAS_ATTR_BIRTHNAME)));
+    simpleEidasData.setAddress(EidasResponseUtils.processAddress(
+        eidasAttrMap.get(Constants.eIDAS_ATTR_CURRENTADDRESS)));
+
+    if (eidasAttrMap.containsKey(Constants.eIDAS_ATTR_TAXREFERENCE)) {
+      simpleEidasData.setTaxNumber(EidasResponseUtils.processTaxReference(
+          eidasAttrMap.get(Constants.eIDAS_ATTR_TAXREFERENCE)));
+    }
+
+    //TODO other additional attributes
+    return simpleEidasData;
+  }
+
   private Map<String, Object> convertEidasAttrToSimpleMap(
       ImmutableMap<AttributeDefinition<?>, ImmutableSet<? extends AttributeValue<?>>> attributeMap) {
     final Map<String, Object> result = new HashMap<>();
@@ -289,7 +284,6 @@ public class InitialSearchTask extends AbstractAuthServletTask {
         } else {
           log.info("Ignore empty 'DateTime' attribute");
         }
-
       } else if (PostalAddress.class.equals(parameterizedType)) {
         final PostalAddress addressAttribute = EidasResponseUtils
             .translateAddressAttribute(el, attributeMap.get(el).asList());
@@ -300,7 +294,6 @@ public class InitialSearchTask extends AbstractAuthServletTask {
         } else {
           log.info("Ignore empty 'PostalAddress' attribute");
         }
-
       } else {
         final List<String> natPersonIdObj = EidasResponseUtils
             .translateStringListAttribute(el, attributeMap.get(el).asList());
@@ -308,7 +301,6 @@ public class InitialSearchTask extends AbstractAuthServletTask {
         if (StringUtils.isNotEmpty(stringAttr)) {
           result.put(el.getFriendlyName(), stringAttr);
           log.trace("Find attr '" + el.getFriendlyName() + "' with value: " + stringAttr);
-
         } else {
           log.info("Ignore empty 'String' attribute");
         }
@@ -317,18 +309,4 @@ public class InitialSearchTask extends AbstractAuthServletTask {
     log.debug("Receive #" + result.size() + " attributes with names: " + result.keySet().toString());
     return result;
   }
-
-  /**
-   * Constructor.
-   * @param handlers List of countrySpecificSearchProcessors
-   * @param ernbClient Ernb client
-   * @param zmrClient ZMR client
-   */
-  public InitialSearchTask(List<ICountrySpecificDetailSearchProcessor> handlers, IErnbClient ernbClient,
-                           IZmrClient zmrClient) {
-    this.ernbClient = ernbClient;
-    this.zmrClient = zmrClient;
-    this.handlers = handlers;
-    log.info("# " + handlers.size() + " country specific detail search services are registered");
-  }
 }
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveAuthnResponseTask.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveAuthnResponseTask.java
index 684546f7..0f733e8d 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveAuthnResponseTask.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveAuthnResponseTask.java
@@ -94,7 +94,7 @@ public class ReceiveAuthnResponseTask extends AbstractAuthServletTask {
           attrRegistry);
 
       // **********************************************************
-      // ******* Store resonse infos into session object **********
+      // ******* Store response infos into session object **********
       // **********************************************************
 
       // update MOA-Session data with received information
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/utils/EidasResponseUtils.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/utils/EidasResponseUtils.java
index 55c1c31a..fb223ee7 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/utils/EidasResponseUtils.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/utils/EidasResponseUtils.java
@@ -23,32 +23,28 @@
 
 package at.asitplus.eidas.specific.modules.auth.eidas.v2.utils;
 
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import javax.annotation.Nullable;
-
-import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.EidPostProcessingException;
+import at.asitplus.eidas.specific.modules.auth.eidas.v2.Constants;
 import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.EidasAttributeException;
 import at.gv.e_government.reference.namespace.persondata._20020228.PostalAddressType;
-import org.apache.commons.lang3.StringUtils;
-import org.joda.time.DateTime;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.collect.ImmutableList;
-
-import at.asitplus.eidas.specific.modules.auth.eidas.v2.Constants;
 import at.gv.egiz.eaaf.core.impl.data.Triple;
+import com.google.common.collect.ImmutableList;
 import eu.eidas.auth.commons.attribute.AttributeDefinition;
 import eu.eidas.auth.commons.attribute.AttributeValue;
 import eu.eidas.auth.commons.attribute.AttributeValueMarshaller;
 import eu.eidas.auth.commons.attribute.AttributeValueMarshallingException;
 import eu.eidas.auth.commons.attribute.AttributeValueTransliterator;
 import eu.eidas.auth.commons.protocol.eidas.impl.PostalAddress;
+import org.apache.commons.lang3.StringUtils;
+import org.joda.time.DateTime;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.annotation.Nullable;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 public class EidasResponseUtils {
   private static final Logger log = LoggerFactory.getLogger(EidasResponseUtils.class);
@@ -170,7 +166,6 @@ public class EidasResponseUtils {
       ImmutableList<? extends AttributeValue<?>> attributeValues) {
     final AttributeValue<?> firstAttributeValue = attributeValues.get(0);
     return (PostalAddress) firstAttributeValue.getValue();
-
   }
 
   /**
@@ -178,34 +173,24 @@ public class EidasResponseUtils {
    *
    * @param currentAddressObj eIDAS current address information
    * @return current address or null if no attribute is available
-   * @throws EidPostProcessingException if post-processing fails
    * @throws EidasAttributeException    if eIDAS attribute is of a wrong type
    */
-  public static PostalAddressType processAddress(Object currentAddressObj) throws EidPostProcessingException,
-      EidasAttributeException {
-
+  public static PostalAddressType processAddress(Object currentAddressObj) throws EidasAttributeException {
     if (currentAddressObj != null) {
       if (currentAddressObj instanceof PostalAddress) {
         final PostalAddressType result = new PostalAddressType();
         result.setPostalCode(((PostalAddress) currentAddressObj).getPostCode());
         result.setMunicipality(((PostalAddress) currentAddressObj).getPostName());
-
         // TODO: add more mappings
-
         return result;
-
       } else {
         log.warn("eIDAS attr: " + Constants.eIDAS_ATTR_CURRENTADDRESS + " is of WRONG type");
         throw new EidasAttributeException(Constants.eIDAS_ATTR_CURRENTADDRESS);
-
       }
-
     } else {
       log.debug("NO '" + Constants.eIDAS_ATTR_CURRENTADDRESS + "' attribute. Post-Processing skipped ... ");
     }
-
     return null;
-
   }
 
   /**
@@ -213,27 +198,20 @@ public class EidasResponseUtils {
    *
    * @param birthNameObj eIDAS birthname information
    * @return birthName or null if no attribute is available
-   * @throws EidPostProcessingException if post-processing fails
    * @throws EidasAttributeException    if eIDAS attribute is of a wrong type
    */
-  public static String processBirthName(Object birthNameObj) throws EidPostProcessingException,
-      EidasAttributeException {
+  public static String processBirthName(Object birthNameObj) throws EidasAttributeException {
     if (birthNameObj != null) {
       if (birthNameObj instanceof String) {
         return (String) birthNameObj;
-
       } else {
         log.warn("eIDAS attr: " + Constants.eIDAS_ATTR_BIRTHNAME + " is of WRONG type");
         throw new EidasAttributeException(Constants.eIDAS_ATTR_BIRTHNAME);
-
       }
-
     } else {
       log.debug("NO '" + Constants.eIDAS_ATTR_BIRTHNAME + "' attribute. Post-Processing skipped ... ");
     }
-
     return null;
-
   }
 
   /**
@@ -241,11 +219,9 @@ public class EidasResponseUtils {
    *
    * @param placeOfBirthObj eIDAS Place-of-Birth information
    * @return place of Birth or null if no attribute is available
-   * @throws EidPostProcessingException if post-processing fails
    * @throws EidasAttributeException    if eIDAS attribute is of a wrong type
    */
-  public static String processPlaceOfBirth(Object placeOfBirthObj) throws EidPostProcessingException,
-      EidasAttributeException {
+  public static String processPlaceOfBirth(Object placeOfBirthObj) throws EidasAttributeException {
     if (placeOfBirthObj != null) {
       if (placeOfBirthObj instanceof String) {
         return (String) placeOfBirthObj;
@@ -259,9 +235,7 @@ public class EidasResponseUtils {
     } else {
       log.debug("NO '" + Constants.eIDAS_ATTR_PLACEOFBIRTH + "' attribute. Post-Processing skipped ... ");
     }
-
     return null;
-
   }
 
   /**
@@ -270,16 +244,12 @@ public class EidasResponseUtils {
    * @param dateOfBirthObj eIDAS date-of-birth attribute information
    * @return formated user's date-of-birth
    * @throws EidasAttributeException    if NO attribute is available
-   * @throws EidPostProcessingException if post-processing fails
    */
-  public static DateTime processDateOfBirth(Object dateOfBirthObj) throws EidPostProcessingException,
-      EidasAttributeException {
-    if (dateOfBirthObj == null || !(dateOfBirthObj instanceof DateTime)) {
+  public static DateTime processDateOfBirth(Object dateOfBirthObj) throws EidasAttributeException {
+    if (!(dateOfBirthObj instanceof DateTime)) {
       throw new EidasAttributeException(Constants.eIDAS_ATTR_DATEOFBIRTH);
     }
-
     return (DateTime) dateOfBirthObj;
-
   }
 
   /**
@@ -288,11 +258,9 @@ public class EidasResponseUtils {
    * @param dateOfBirthObj eIDAS date-of-birth attribute information
    * @return formated user's date-of-birth as string
    * @throws EidasAttributeException    if NO attribute is available
-   * @throws EidPostProcessingException if post-processing fails
    */
-  public static String processDateOfBirthToString(Object dateOfBirthObj) throws EidPostProcessingException,
-      EidasAttributeException {
-    if (dateOfBirthObj == null || !(dateOfBirthObj instanceof DateTime)) {
+  public static String processDateOfBirthToString(Object dateOfBirthObj) throws EidasAttributeException {
+    if (!(dateOfBirthObj instanceof DateTime)) {
       throw new EidasAttributeException(Constants.eIDAS_ATTR_DATEOFBIRTH);
     }
     return new SimpleDateFormat("yyyy-MM-dd").format(((DateTime) dateOfBirthObj).toDate());
@@ -304,16 +272,12 @@ public class EidasResponseUtils {
    * @param givenNameObj eIDAS givenName attribute information
    * @return formated user's givenname
    * @throws EidasAttributeException    if NO attribute is available
-   * @throws EidPostProcessingException if post-processing fails
    */
-  public static String processGivenName(Object givenNameObj) throws EidPostProcessingException,
-      EidasAttributeException {
-    if (givenNameObj == null || !(givenNameObj instanceof String)) {
+  public static String processGivenName(Object givenNameObj) throws EidasAttributeException {
+    if (!(givenNameObj instanceof String)) {
       throw new EidasAttributeException(Constants.eIDAS_ATTR_CURRENTGIVENNAME);
     }
-
     return (String) givenNameObj;
-
   }
 
   /**
@@ -322,16 +286,12 @@ public class EidasResponseUtils {
    * @param familyNameObj eIDAS familyName attribute information
    * @return formated user's familyname
    * @throws EidasAttributeException    if NO attribute is available
-   * @throws EidPostProcessingException if post-processing fails
    */
-  public static String processFamilyName(Object familyNameObj) throws EidPostProcessingException,
-      EidasAttributeException {
-    if (familyNameObj == null || !(familyNameObj instanceof String)) {
+  public static String processFamilyName(Object familyNameObj) throws EidasAttributeException {
+    if (!(familyNameObj instanceof String)) {
       throw new EidasAttributeException(Constants.eIDAS_ATTR_CURRENTFAMILYNAME);
     }
-
     return (String) familyNameObj;
-
   }
 
   /**
@@ -340,17 +300,16 @@ public class EidasResponseUtils {
    * @param personalIdObj eIDAS PersonalIdentifierAttribute
    * @return Unique personal identifier without country-code information
    * @throws EidasAttributeException    if NO attribute is available
-   * @throws EidPostProcessingException if post-processing fails
    */
-  public static String processPseudonym(Object personalIdObj) throws EidPostProcessingException,
-      EidasAttributeException {
-    if (personalIdObj == null || !(personalIdObj instanceof String)) {
+  public static String processPseudonym(Object personalIdObj) throws EidasAttributeException {
+    if (!(personalIdObj instanceof String)) {
       throw new EidasAttributeException(Constants.eIDAS_ATTR_PERSONALIDENTIFIER);
     }
-
     final Triple<String, String, String> eIdentifier =
         EidasResponseUtils.parseEidasPersonalIdentifier((String) personalIdObj);
-
+    if (eIdentifier.getThird() == null) {
+      throw new EidasAttributeException("Error processing eIdentifier");
+    }
     return eIdentifier.getThird();
   }
 
@@ -360,15 +319,11 @@ public class EidasResponseUtils {
    * @param taxReferenceObj eIDAS TaxReference attribute information
    * @return formated user's TaxReference
    * @throws EidasAttributeException    if NO attribute is available
-   * @throws EidPostProcessingException if post-processing fails
    */
-  public static String processTaxReference(Object taxReferenceObj) throws EidPostProcessingException,
-      EidasAttributeException {
-    if (taxReferenceObj == null || !(taxReferenceObj instanceof String)) {
+  public static String processTaxReference(Object taxReferenceObj) throws EidasAttributeException {
+    if (!(taxReferenceObj instanceof String)) {
       throw new EidasAttributeException(Constants.eIDAS_ATTR_CURRENTGIVENNAME);
     }
-
     return (String) taxReferenceObj;
-
   }
 }
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/zmr/DummyZmrClient.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/zmr/DummyZmrClient.java
index f4d77b03..60dd2ef2 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/zmr/DummyZmrClient.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/zmr/DummyZmrClient.java
@@ -1,3 +1,26 @@
+/*
+ * Copyright 2020 A-SIT Plus GmbH
+ * AT-specific eIDAS Connector has been developed in a cooperation between EGIZ,
+ * A-SIT Plus GmbH, A-SIT, and Graz University of Technology.
+ *
+ * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "License");
+ * You may not use this work except in compliance with the License.
+ * You may obtain a copy of the License at:
+ * https://joinup.ec.europa.eu/news/understanding-eupl-v12
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text
+ * file for details on the various modules and licenses.
+ * The "NOTICE" text file is part of the distribution. Any derivative works
+ * that you distribute must include a readable copy of the "NOTICE" text file.
+ */
+
 package at.asitplus.eidas.specific.modules.auth.eidas.v2.zmr;
 
 import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.RegisterResult;
@@ -10,7 +33,7 @@ import java.util.ArrayList;
 public class DummyZmrClient implements IZmrClient {
 
   @Override
-  public ArrayList<RegisterResult> searchWithPersonIdentifer(String personIdentifer) {
+  public ArrayList<RegisterResult> searchWithPersonIdentifier(String personIdentifier) {
     return resultEmpty();
   }
 
@@ -26,7 +49,7 @@ public class DummyZmrClient implements IZmrClient {
   }
 
   @Override
-  public ArrayList<RegisterResult> searchItSpecific(String txNumber) {
+  public ArrayList<RegisterResult> searchItSpecific(String taxNumber) {
     return resultEmpty();//TODO
   }
 
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/zmr/IZmrClient.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/zmr/IZmrClient.java
index 4af7bfe9..3a518e64 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/zmr/IZmrClient.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/zmr/IZmrClient.java
@@ -1,3 +1,26 @@
+/*
+ * Copyright 2020 A-SIT Plus GmbH
+ * AT-specific eIDAS Connector has been developed in a cooperation between EGIZ,
+ * A-SIT Plus GmbH, A-SIT, and Graz University of Technology.
+ *
+ * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "License");
+ * You may not use this work except in compliance with the License.
+ * You may obtain a copy of the License at:
+ * https://joinup.ec.europa.eu/news/understanding-eupl-v12
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text
+ * file for details on the various modules and licenses.
+ * The "NOTICE" text file is part of the distribution. Any derivative works
+ * that you distribute must include a readable copy of the "NOTICE" text file.
+ */
+
 package at.asitplus.eidas.specific.modules.auth.eidas.v2.zmr;
 
 import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.RegisterResult;
@@ -7,14 +30,14 @@ import java.util.ArrayList;
 
 public interface IZmrClient {
 
-  ArrayList<RegisterResult> searchWithPersonIdentifer(String personIdentifer);
+  ArrayList<RegisterResult> searchWithPersonIdentifier(String personIdentifier);
 
   ArrayList<RegisterResult> searchWithMds(String givenName, String familyName, String dateOfBirth);
 
   ArrayList<RegisterResult> searchDeSpecific(String givenName, String familyName, String dateOfBirth,
                                              String birthPlace, String birthName);
 
-  ArrayList<RegisterResult> searchItSpecific(String txNumber);
+  ArrayList<RegisterResult> searchItSpecific(String taxNumber);
 
   void update(RegisterResult registerResult, SimpleEidasData eidData);
 }
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/resources/eidas_v2_auth.beans.xml b/eidas_modules/authmodule-eIDAS-v2/src/main/resources/eidas_v2_auth.beans.xml
index ca6eba20..52404bab 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/resources/eidas_v2_auth.beans.xml
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/resources/eidas_v2_auth.beans.xml
@@ -18,7 +18,7 @@
     class="at.asitplus.eidas.specific.modules.auth.eidas.v2.szr.SzrClient" />
 
   <bean id="ErnbClientForeIDAS"
-        class="at.asitplus.eidas.specific.modules.auth.eidas.v2.ernb.DummyErnbClient" />
+        class="at.asitplus.eidas.specific.modules.auth.eidas.v2.ernp.DummyErnpClient" />
 
   <bean id="ZmrClientForeIDAS"
         class="at.asitplus.eidas.specific.modules.auth.eidas.v2.zmr.DummyZmrClient" />
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskFirstTest.java b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskFirstTest.java
index f7fc6b06..a1dce0f2 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskFirstTest.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskFirstTest.java
@@ -1,11 +1,34 @@
+/*
+ * Copyright 2020 A-SIT Plus GmbH
+ * AT-specific eIDAS Connector has been developed in a cooperation between EGIZ,
+ * A-SIT Plus GmbH, A-SIT, and Graz University of Technology.
+ *
+ * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "License");
+ * You may not use this work except in compliance with the License.
+ * You may obtain a copy of the License at:
+ * https://joinup.ec.europa.eu/news/understanding-eupl-v12
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text
+ * file for details on the various modules and licenses.
+ * The "NOTICE" text file is part of the distribution. Any derivative works
+ * that you distribute must include a readable copy of the "NOTICE" text file.
+ */
+
 package at.asitplus.eidas.specific.modules.auth.eidas.v2.test.tasks;
 
 import at.asitplus.eidas.specific.modules.auth.eidas.v2.Constants;
 import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.RegisterResult;
-import at.asitplus.eidas.specific.modules.auth.eidas.v2.ernb.IErnbClient;
+import at.asitplus.eidas.specific.modules.auth.eidas.v2.ernp.IErnpClient;
 import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.ManualFixNecessaryException;
 import at.asitplus.eidas.specific.modules.auth.eidas.v2.handler.DeSpecificDetailSearchProcessor;
-import at.asitplus.eidas.specific.modules.auth.eidas.v2.handler.ICountrySpecificDetailSearchProcessor;
+import at.asitplus.eidas.specific.modules.auth.eidas.v2.handler.CountrySpecificDetailSearchProcessor;
 import at.asitplus.eidas.specific.modules.auth.eidas.v2.handler.ItSpecificDetailSearchProcessor;
 import at.asitplus.eidas.specific.modules.auth.eidas.v2.tasks.InitialSearchTask;
 import at.asitplus.eidas.specific.modules.auth.eidas.v2.zmr.IZmrClient;
@@ -27,10 +50,7 @@ import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.runner.RunWith;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
 import org.mockito.Mockito;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.mock.web.MockHttpServletRequest;
 import org.springframework.mock.web.MockHttpServletResponse;
 import org.springframework.test.annotation.DirtiesContext;
@@ -46,6 +66,7 @@ import java.net.URI;
 import java.net.URISyntaxException;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Random;
 
 @RunWith(SpringJUnit4ClassRunner.class)
 
@@ -53,13 +74,9 @@ import java.util.List;
 @DirtiesContext(classMode = ClassMode.BEFORE_CLASS)
 public class InitialSearchTaskFirstTest {
 
-  @Autowired(required = true)
-  @Mock
-  @InjectMocks
   private InitialSearchTask task;
-
   private IZmrClient zmrClient;
-  private IErnbClient ernbClient;
+  private IErnpClient ernpClient;
 
   final ExecutionContext executionContext = new ExecutionContextImpl();
   private MockHttpServletRequest httpReq;
@@ -68,6 +85,12 @@ public class InitialSearchTaskFirstTest {
   private String randomIdentifier = RandomStringUtils.randomNumeric(10);
   private String randomFamilyName = RandomStringUtils.randomNumeric(11);
   private String randomGivenName = RandomStringUtils.randomNumeric(12);
+  private String randomPlaceOfBirth = RandomStringUtils.randomNumeric(12);
+  private String randomBirthName = RandomStringUtils.randomNumeric(12);
+  private String randomDate = "2011-01-"+ (10 + new Random().nextInt(18));
+  private String DE_ST = "de/st/";
+  private String IT_ST = "it/st/";
+
   /**
    * jUnit class initializer.
    *
@@ -101,68 +124,52 @@ public class InitialSearchTaskFirstTest {
   /**
    * One match, but register update needed
    */
-  // NOTE: Why is the method named "testNode100a"?
-  public void testNode100a() throws Exception {
+  public void testNode100_UserIdentifiedUpdateNecessary_a() throws Exception {
 
-    //Mock ZMR
     ArrayList<RegisterResult> zmrResult = new ArrayList<>();
     String randomBpk = RandomStringUtils.randomNumeric(6);
-    zmrResult.add(new RegisterResult(randomBpk, "de/st/"+randomIdentifier, "Max_new", randomFamilyName, "2011-01-01"));
+    String newFirstName = RandomStringUtils.randomAlphabetic(5);
+    zmrResult.add(new RegisterResult(randomBpk, DE_ST+randomIdentifier, newFirstName, randomFamilyName, randomDate));
 
     zmrClient = Mockito.mock(IZmrClient.class);
-    Mockito.when(zmrClient.searchWithPersonIdentifer(randomIdentifier)).thenReturn(zmrResult);
-
-    //Mock ernb
-    ArrayList<RegisterResult> ernbResult = new ArrayList<>();
+    Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(zmrResult);
 
-    ernbClient = Mockito.mock(IErnbClient.class);
-    Mockito.when(ernbClient.searchWithPersonIdentifer(randomIdentifier)).thenReturn(ernbResult);
-
-    task = new InitialSearchTask(emptyHandlers(), ernbClient, zmrClient);
-    try {
-      task.execute(pendingReq, executionContext);
-      String bPk = (String)
-          pendingReq.getSessionData(AuthProcessDataWrapper.class).getGenericDataFromSession(Constants.DATA_RESULT_MATCHING_BPK);
-      Assert.assertTrue("Wrong bpk", bPk.equals(randomBpk));
+    ArrayList<RegisterResult> ernpResult = new ArrayList<>();
+    ernpClient = Mockito.mock(IErnpClient.class);
+    Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(ernpResult);
 
-    } catch (final TaskExecutionException e) {
-      // NOTE: assertTrue is probably the wrong method to use ... why catch the exception anyway?
-      Assert.assertTrue("Wrong workflow, should not reach this point", false);
-    }
+    task = new InitialSearchTask(emptyHandlers(), ernpClient, zmrClient);
+    task.execute(pendingReq, executionContext);
+    String bPk = (String)
+        pendingReq.getSessionData(AuthProcessDataWrapper.class).getGenericDataFromSession(Constants.DATA_RESULT_MATCHING_BPK);
+    Assert.assertTrue("Wrong bpk", bPk.equals(randomBpk));
   }
 
   @Test
-  // NOTE: Why is @DirtiesContext after each test necessary? What is changed in the context and why?
   @DirtiesContext
   /**
    * One match, but register update needed
    */
-  public void testNode100b() throws Exception {
+  public void testNode100_UserIdentifiedUpdateNecessary_b() throws TaskExecutionException {
 
-    //Mock ZMR
     ArrayList<RegisterResult> zmrResult = new ArrayList<>();
 
     zmrClient = Mockito.mock(IZmrClient.class);
-    Mockito.when(zmrClient.searchWithPersonIdentifer(randomIdentifier)).thenReturn(zmrResult);//"de/st/max123"???
+    Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(zmrResult);
 
-    //Mock ernb
-    ArrayList<RegisterResult> ernbResult = new ArrayList<>();
+    ArrayList<RegisterResult> ernpResult = new ArrayList<>();
     String randomBpk = RandomStringUtils.randomNumeric(6);
-    ernbResult.add(new RegisterResult(randomBpk, "de/st/"+randomIdentifier, "Max_new", randomFamilyName, "2011-01-01"));
+    ernpResult.add(new RegisterResult(randomBpk, DE_ST+randomIdentifier, "Max_new", randomFamilyName, randomDate));
 
-    ernbClient = Mockito.mock(IErnbClient.class);
-    Mockito.when(ernbClient.searchWithPersonIdentifer(randomIdentifier)).thenReturn(ernbResult);
+    ernpClient = Mockito.mock(IErnpClient.class);
+    Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(ernpResult);
 
-    task = new InitialSearchTask(emptyHandlers(), ernbClient, zmrClient);
-    try {
-      task.execute(pendingReq, executionContext);
-      String bPk = (String)
-          pendingReq.getSessionData(AuthProcessDataWrapper.class).getGenericDataFromSession(Constants.DATA_RESULT_MATCHING_BPK);
-      Assert.assertTrue("Wrong bpk", bPk.equals(randomBpk));
+    task = new InitialSearchTask(emptyHandlers(), ernpClient, zmrClient);
+    task.execute(pendingReq, executionContext);
+    String bPk = (String)
+        pendingReq.getSessionData(AuthProcessDataWrapper.class).getGenericDataFromSession(Constants.DATA_RESULT_MATCHING_BPK);
+    Assert.assertTrue("Wrong bpk", bPk.equals(randomBpk));
 
-    } catch (final TaskExecutionException e) {
-      Assert.assertTrue("Wrong workflow, should not reach this point", false);
-    }
   }
 
 
@@ -171,21 +178,19 @@ public class InitialSearchTaskFirstTest {
   /**
    * Two matches found in ZMR
    */
-  public void testNode101a() throws Exception {
+  public void testNode101_ManualFixNecessary_a() throws Exception {
 
-    //Mock ZMR
     ArrayList<RegisterResult> zmrResult = new ArrayList<>();
-    zmrResult.add(new RegisterResult("bpkMax", "de/st/"+randomIdentifier, randomGivenName, randomFamilyName, "2011-01-01"));
-    zmrResult.add(new RegisterResult("bpkMax", "de/st/"+randomIdentifier, "Maximilian", randomFamilyName, "2011-01-01"));
+    zmrResult.add(new RegisterResult("bpkMax", DE_ST+randomIdentifier, randomGivenName, randomFamilyName, randomDate));
+    zmrResult.add(new RegisterResult("bpkMax", DE_ST+randomIdentifier, "Maximilian", randomFamilyName, randomDate));
     zmrClient = Mockito.mock(IZmrClient.class);
-    Mockito.when(zmrClient.searchWithPersonIdentifer(randomIdentifier)).thenReturn(zmrResult);
+    Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(zmrResult);
 
-    //Mock ernb
-    ArrayList<RegisterResult> ernbResult = new ArrayList<>();
-    ernbClient = Mockito.mock(IErnbClient.class);
-    Mockito.when(ernbClient.searchWithPersonIdentifer(randomIdentifier)).thenReturn(ernbResult);
+    ArrayList<RegisterResult> ernpResult = new ArrayList<>();
+    ernpClient = Mockito.mock(IErnpClient.class);
+    Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(ernpResult);
 
-    task = new InitialSearchTask(emptyHandlers(), ernbClient, zmrClient);
+    task = new InitialSearchTask(emptyHandlers(), ernpClient, zmrClient);
     try {
       task.execute(pendingReq, executionContext);
       Assert.assertTrue("Wrong workflow, should not reach this point/ get a bpk", false);
@@ -199,24 +204,24 @@ public class InitialSearchTaskFirstTest {
   @Test
   @DirtiesContext
   /**
-   * Two matches found in ErnB
+   * Two matches found in ErnP
    */
-  public void testNode101b() throws Exception {
-
-    //Mock ZMR
+  public void testNode101_ManualFixNecessary_b() throws Exception {
+    String randombpk = RandomStringUtils.random(5);
     ArrayList<RegisterResult> zmrResult = new ArrayList<>();
     zmrClient = Mockito.mock(IZmrClient.class);
-    Mockito.when(zmrClient.searchWithPersonIdentifer(randomIdentifier)).thenReturn(zmrResult);
+    Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(zmrResult);
 
-    //Mock ernb
-    ArrayList<RegisterResult> ernbResult = new ArrayList<>();
-    ernbResult.add(new RegisterResult("bpkMax", "de/st/"+randomIdentifier, randomGivenName, randomFamilyName, "2011-01-01"));
-    ernbResult.add(new RegisterResult("bpkMax", "de/st/"+randomIdentifier, "Maximilian", randomFamilyName, "2011-01-01"));
+    ArrayList<RegisterResult> ernpResult = new ArrayList<>();
+    ernpResult.add(new RegisterResult(randombpk, DE_ST+randomIdentifier, randomGivenName, randomFamilyName, randomDate));
+    ernpResult.add(new RegisterResult(randombpk, DE_ST+randomIdentifier, randomGivenName+RandomStringUtils.random(2),
+        randomFamilyName,
+        randomDate));
 
-    ernbClient = Mockito.mock(IErnbClient.class);
-    Mockito.when(ernbClient.searchWithPersonIdentifer(randomIdentifier)).thenReturn(ernbResult);
+    ernpClient = Mockito.mock(IErnpClient.class);
+    Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(ernpResult);
 
-    task = new InitialSearchTask(emptyHandlers(), ernbClient, zmrClient);
+    task = new InitialSearchTask(emptyHandlers(), ernpClient, zmrClient);
     try {
       task.execute(pendingReq, executionContext);
       Assert.assertTrue("Wrong workflow, should not reach this point/ get a bpk", false);
@@ -231,30 +236,24 @@ public class InitialSearchTaskFirstTest {
   /**
    * One match, no register update needed
    */
-  public void testNode102a() throws Exception {
+  public void testNode102_UserIdentified_a() throws Exception {
 
-    String randomBpk = RandomStringUtils.randomNumeric(12);;
-    //Mock ZMR
+    String randomBpk = RandomStringUtils.randomNumeric(12);
     ArrayList<RegisterResult> zmrResult = new ArrayList<>();
     zmrClient = Mockito.mock(IZmrClient.class);
-    Mockito.when(zmrClient.searchWithPersonIdentifer(randomIdentifier)).thenReturn(zmrResult);
+    Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(zmrResult);
 
-    //Mock ernb
-    ArrayList<RegisterResult> ernbResult = new ArrayList<>();
-    ernbResult.add(new RegisterResult(randomBpk, "de/st/"+randomIdentifier, randomGivenName, randomFamilyName, "2011-01-01"));
+    ArrayList<RegisterResult> ernpResult = new ArrayList<>();
+    ernpResult.add(new RegisterResult(randomBpk, DE_ST+randomIdentifier, randomGivenName, randomFamilyName, randomDate));
 
-    ernbClient = Mockito.mock(IErnbClient.class);
-    Mockito.when(ernbClient.searchWithPersonIdentifer(randomIdentifier)).thenReturn(ernbResult);
+    ernpClient = Mockito.mock(IErnpClient.class);
+    Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(ernpResult);
 
-    task = new InitialSearchTask(emptyHandlers(), ernbClient, zmrClient);
-    try {
-      task.execute(pendingReq, executionContext);
-      String bPk = (String)
-          pendingReq.getSessionData(AuthProcessDataWrapper.class).getGenericDataFromSession(Constants.DATA_RESULT_MATCHING_BPK);
-      Assert.assertTrue("Wrong bpk", bPk.equals(randomBpk));
-    } catch (final TaskExecutionException e) {
-      Assert.assertTrue("Wrong workflow, should not reach this point", false);
-    }
+    task = new InitialSearchTask(emptyHandlers(), ernpClient, zmrClient);
+    task.execute(pendingReq, executionContext);
+    String bPk = (String)
+        pendingReq.getSessionData(AuthProcessDataWrapper.class).getGenericDataFromSession(Constants.DATA_RESULT_MATCHING_BPK);
+    Assert.assertTrue("Wrong bpk", bPk.equals(randomBpk));
   }
 
   @Test
@@ -262,39 +261,33 @@ public class InitialSearchTaskFirstTest {
   /**
    * One match, no register update needed
    */
-  public void testNode102b() throws Exception {
+  public void testNode102_UserIdentified_b() throws Exception {
     String randomBpk = RandomStringUtils.randomNumeric(14);
-    //Mock ZMR
+
     ArrayList<RegisterResult> zmrResult = new ArrayList<>();
-    zmrResult.add(new RegisterResult(randomBpk, "de/st/"+randomIdentifier, randomGivenName, randomFamilyName, "2011-01-01"));
+    zmrResult.add(new RegisterResult(randomBpk, DE_ST+randomIdentifier, randomGivenName, randomFamilyName, randomDate));
 
     zmrClient = Mockito.mock(IZmrClient.class);
-    Mockito.when(zmrClient.searchWithPersonIdentifer(randomIdentifier)).thenReturn(zmrResult);
+    Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(zmrResult);
 
-    //Mock ernb
-    ArrayList<RegisterResult> ernbResult = new ArrayList<>();
+    ArrayList<RegisterResult> ernpResult = new ArrayList<>();
 
-    ernbClient = Mockito.mock(IErnbClient.class);
-    Mockito.when(ernbClient.searchWithPersonIdentifer(randomIdentifier)).thenReturn(ernbResult);
+    ernpClient = Mockito.mock(IErnpClient.class);
+    Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(ernpResult);
 
-    task = new InitialSearchTask(emptyHandlers(), ernbClient, zmrClient);
-    try {
-      task.execute(pendingReq, executionContext);
-      String bPk = (String)
-          pendingReq.getSessionData(AuthProcessDataWrapper.class).getGenericDataFromSession(Constants.DATA_RESULT_MATCHING_BPK);
-      Assert.assertTrue("Wrong bpk", bPk.equals(randomBpk));
-
-    } catch (final TaskExecutionException e) {
-      Assert.assertTrue("Wrong workflow, should not reach this point", false);
-    }
+    task = new InitialSearchTask(emptyHandlers(), ernpClient, zmrClient);
+    task.execute(pendingReq, executionContext);
+    String bPk = (String)
+        pendingReq.getSessionData(AuthProcessDataWrapper.class).getGenericDataFromSession(Constants.DATA_RESULT_MATCHING_BPK);
+    Assert.assertTrue("Wrong bpk", bPk.equals(randomBpk));
   }
 
   @Test
   @DirtiesContext
   /**
-   * One match found in ZMR and ErnB with detail search
+   * One match found in ZMR and ErnP with detail search
    */
-  public void testNode103IT() throws Exception {
+  public void testNode103_UserIdentified_IT() throws Exception {
     String bpkRegister = RandomStringUtils.randomNumeric(14);
     String taxNumber = RandomStringUtils.randomNumeric(14);
     final AuthenticationResponse response = buildDummyAuthResponseRandomPersonIT_Tax(taxNumber);
@@ -302,29 +295,26 @@ public class InitialSearchTaskFirstTest {
     pendingReq1.getSessionData(AuthProcessDataWrapper.class)
         .setGenericDataToSession(Constants.DATA_FULL_EIDAS_RESPONSE, response);
 
-    //Mock ZMR initial search
     ArrayList<RegisterResult> zmrResultInitial = new ArrayList<>();
     zmrClient = Mockito.mock(IZmrClient.class);
-    Mockito.when(zmrClient.searchWithPersonIdentifer(randomIdentifier)).thenReturn(zmrResultInitial);
+    Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(zmrResultInitial);
     ArrayList<RegisterResult> zmrResultSpecific = new ArrayList<>();
-    //String bpk, String pseudonym, String givenName, String familyName, String dateOfBirth,
-    //                        String placeOfBirth, String birthName, String taxNumber, PostalAddressType address
-    zmrResultSpecific.add(new RegisterResult(bpkRegister, "it/st/"+randomIdentifier+"4", randomGivenName, randomFamilyName,
-        "2011-01-01", null, null, taxNumber, null));
 
-    Mockito.when(zmrClient.searchItSpecific(taxNumber)).thenReturn(zmrResultSpecific);
+    zmrResultSpecific.add(new RegisterResult(bpkRegister, IT_ST+randomIdentifier+RandomStringUtils.random(2),
+        randomGivenName,
+        randomFamilyName,
+        randomDate, null, null, taxNumber, null));
 
-    //Mock ernb initial search
-    ArrayList<RegisterResult> ernbResultInitial = new ArrayList<>();
-    ernbClient = Mockito.mock(IErnbClient.class);
-    Mockito.when(ernbClient.searchWithPersonIdentifer(randomIdentifier)).thenReturn(ernbResultInitial);
+    Mockito.when(zmrClient.searchItSpecific(taxNumber)).thenReturn(zmrResultSpecific);
 
+    ArrayList<RegisterResult> ernpResultInitial = new ArrayList<>();
+    ernpClient = Mockito.mock(IErnpClient.class);
+    Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(ernpResultInitial);
 
-    //Mock country specific search
-    List<ICountrySpecificDetailSearchProcessor> handlers = new ArrayList<>();
-    ItSpecificDetailSearchProcessor it = new ItSpecificDetailSearchProcessor(ernbClient, zmrClient);
+    List<CountrySpecificDetailSearchProcessor> handlers = new ArrayList<>();
+    ItSpecificDetailSearchProcessor it = new ItSpecificDetailSearchProcessor(ernpClient, zmrClient);
     handlers.add(it);
-    task = new InitialSearchTask(handlers, ernbClient, zmrClient);
+    task = new InitialSearchTask(handlers, ernpClient, zmrClient);
 
     try {
       task.execute(pendingReq1, executionContext);
@@ -340,26 +330,25 @@ public class InitialSearchTaskFirstTest {
   @Test
   @DirtiesContext
   /**
-   * Multiple matches found in ZMR and ErnB with detail search
+   * Multiple matches found in ZMR and ErnP with detail search
    */
-  public void testNode103DE() throws Exception {
+  public void testNode103_UserIdentified_DE() throws Exception {
     String givenName = randomGivenName;
     String familyName = randomFamilyName;
-    String pseudonym = "de/st/max1234";
-    String bpk = "bpkMax";
-    String dateOfBirth = "2011-01-01";
-    String placeOfBirth = "München";
-    String birthName = "BabyMax";
+    String pseudonym = DE_ST + RandomStringUtils.random(5);
+    String bpk = RandomStringUtils.random(5);
+    String dateOfBirth = randomDate;
+    String placeOfBirth = randomPlaceOfBirth;
+    String birthName = randomBirthName;
     final AuthenticationResponse response = buildDummyAuthResponseDE(givenName, familyName, pseudonym,
         dateOfBirth, placeOfBirth, birthName);
     TestRequestImpl pendingReq1 = new TestRequestImpl();
     pendingReq1.getSessionData(AuthProcessDataWrapper.class)
         .setGenericDataToSession(Constants.DATA_FULL_EIDAS_RESPONSE, response);
 
-    //Mock ZMR initial search
     ArrayList<RegisterResult> zmrResultInitial = new ArrayList<>();
     zmrClient = Mockito.mock(IZmrClient.class);
-    Mockito.when(zmrClient.searchWithPersonIdentifer(randomIdentifier)).thenReturn(zmrResultInitial);
+    Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(zmrResultInitial);
     ArrayList<RegisterResult> zmrResultSpecific = new ArrayList<>();
 
     zmrResultSpecific.add(new RegisterResult(bpk, pseudonym, givenName, familyName, dateOfBirth, placeOfBirth,
@@ -368,16 +357,14 @@ public class InitialSearchTaskFirstTest {
 
     Mockito.when(zmrClient.searchDeSpecific(givenName, familyName, dateOfBirth, placeOfBirth, birthName)).thenReturn(zmrResultSpecific);
 
-    //Mock ernb initial search
-    ArrayList<RegisterResult> ernbResultInitial = new ArrayList<>();
-    ernbClient = Mockito.mock(IErnbClient.class);
-    Mockito.when(ernbClient.searchWithPersonIdentifer(randomIdentifier)).thenReturn(ernbResultInitial);
+    ArrayList<RegisterResult> ernpResultInitial = new ArrayList<>();
+    ernpClient = Mockito.mock(IErnpClient.class);
+    Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(ernpResultInitial);
 
-    //Mock country specific search
-    List<ICountrySpecificDetailSearchProcessor> handlers = new ArrayList<>();
-    DeSpecificDetailSearchProcessor de = new DeSpecificDetailSearchProcessor(ernbClient, zmrClient);
+    List<CountrySpecificDetailSearchProcessor> handlers = new ArrayList<>();
+    DeSpecificDetailSearchProcessor de = new DeSpecificDetailSearchProcessor(ernpClient, zmrClient);
     handlers.add(de);
-    task = new InitialSearchTask(handlers, ernbClient, zmrClient);
+    task = new InitialSearchTask(handlers, ernpClient, zmrClient);
 
     try {
       task.execute(pendingReq1, executionContext);
@@ -393,28 +380,27 @@ public class InitialSearchTaskFirstTest {
   @Test
   @DirtiesContext
   /**
-   * Multiple matches found in ZMR and ErnB with detail search
+   * Multiple matches found in ZMR and ErnP with detail search
    */
-  public void testNode104DE() throws Exception {
+  public void testNode104_ManualFixNecessary_DE() throws Exception {
     String givenName = randomGivenName;
     String familyName = randomFamilyName;
-    String pseudonym1 = "de/st/max1234";
-    String pseudonym2 = "de/st/max12345";
-    String bpk1 = "bpkMax";
-    String bpk2 = "bpkMax1";
-    String dateOfBirth = "2011-01-01";
-    String placeOfBirth = "München";
-    String birthName = "BabyMax";
+    String pseudonym1 = DE_ST + RandomStringUtils.random(5);
+    String pseudonym2 = pseudonym1 + RandomStringUtils.random(2);
+    String bpk1 = RandomStringUtils.random(5);
+    String bpk2 = bpk1 + RandomStringUtils.random(2);
+    String dateOfBirth = randomDate;
+    String placeOfBirth = randomPlaceOfBirth;
+    String birthName = randomBirthName;
     final AuthenticationResponse response = buildDummyAuthResponseDE(givenName, familyName, pseudonym1,
         dateOfBirth, placeOfBirth, birthName);
     TestRequestImpl pendingReq1 = new TestRequestImpl();
     pendingReq1.getSessionData(AuthProcessDataWrapper.class)
         .setGenericDataToSession(Constants.DATA_FULL_EIDAS_RESPONSE, response);
 
-    //Mock ZMR initial search
     ArrayList<RegisterResult> zmrResultInitial = new ArrayList<>();
     zmrClient = Mockito.mock(IZmrClient.class);
-    Mockito.when(zmrClient.searchWithPersonIdentifer(randomIdentifier)).thenReturn(zmrResultInitial);
+    Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(zmrResultInitial);
     ArrayList<RegisterResult> zmrResultSpecific = new ArrayList<>();
 
     zmrResultSpecific.add(new RegisterResult(bpk1, pseudonym1, givenName, familyName, dateOfBirth, placeOfBirth,
@@ -425,23 +411,18 @@ public class InitialSearchTaskFirstTest {
         null, null));
     Mockito.when(zmrClient.searchDeSpecific(givenName, familyName, dateOfBirth, placeOfBirth, birthName)).thenReturn(zmrResultSpecific);
 
+    ArrayList<RegisterResult> ernpResultInitial = new ArrayList<>();
+    ernpClient = Mockito.mock(IErnpClient.class);
+    Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(ernpResultInitial);
 
-    //Mock ernb initial search
-    ArrayList<RegisterResult> ernbResultInitial = new ArrayList<>();
-    ernbClient = Mockito.mock(IErnbClient.class);
-    Mockito.when(ernbClient.searchWithPersonIdentifer(randomIdentifier)).thenReturn(ernbResultInitial);
-
-    //Mock country specific search
-    List<ICountrySpecificDetailSearchProcessor> handlers = new ArrayList<>();
-    DeSpecificDetailSearchProcessor de = new DeSpecificDetailSearchProcessor(ernbClient, zmrClient);
+    List<CountrySpecificDetailSearchProcessor> handlers = new ArrayList<>();
+    DeSpecificDetailSearchProcessor de = new DeSpecificDetailSearchProcessor(ernpClient, zmrClient);
     handlers.add(de);
-    task = new InitialSearchTask(handlers, ernbClient, zmrClient);
+    task = new InitialSearchTask(handlers, ernpClient, zmrClient);
 
     try {
       task.execute(pendingReq1, executionContext);
-
       Assert.assertTrue("Wrong workflow, should not reach this point/ get a bpk", false);
-
     } catch (final TaskExecutionException e) {
       Throwable origE = e.getOriginalException();
       Assert.assertTrue("Wrong exception", (origE.getCause() instanceof ManualFixNecessaryException));
@@ -451,43 +432,40 @@ public class InitialSearchTaskFirstTest {
   @Test
   @DirtiesContext
   /**
-   * Multiple matches found in ZMR and ErnB with detail search
+   * Multiple matches found in ZMR and ErnP with detail search
    */
-  public void testNode104IT() throws Exception {
+  public void testNode104_ManualFixNecessary_IT() throws Exception {
     String fakeTaxNumber = RandomStringUtils.randomNumeric(14);;
     final AuthenticationResponse response = buildDummyAuthResponseRandomPersonIT_Tax(fakeTaxNumber);
     TestRequestImpl pendingReq1 = new TestRequestImpl();
     pendingReq1.getSessionData(AuthProcessDataWrapper.class)
         .setGenericDataToSession(Constants.DATA_FULL_EIDAS_RESPONSE, response);
 
-    //Mock ZMR initial search
     ArrayList<RegisterResult> zmrResultInitial = new ArrayList<>();
     zmrClient = Mockito.mock(IZmrClient.class);
-    Mockito.when(zmrClient.searchWithPersonIdentifer(randomIdentifier)).thenReturn(zmrResultInitial);
+    Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(zmrResultInitial);
     ArrayList<RegisterResult> zmrResultSpecific = new ArrayList<>();
 
-    zmrResultSpecific.add(new RegisterResult("bpkMax", "it/st/"+randomIdentifier+"4", randomGivenName, randomFamilyName, "2011-01-01", null, null,
+    zmrResultSpecific.add(new RegisterResult("bpkMax", IT_ST+randomIdentifier+"4", randomGivenName, randomFamilyName,
+        randomDate, null, null,
         fakeTaxNumber, null));
-    zmrResultSpecific.add(new RegisterResult("bpkMax1", "it/st/"+randomIdentifier+"5", randomGivenName, randomFamilyName, "2011-01-01", null, null,
+    zmrResultSpecific.add(new RegisterResult("bpkMax1", IT_ST+randomIdentifier+"5", randomGivenName, randomFamilyName,
+        randomDate, null, null,
         fakeTaxNumber, null));
     Mockito.when(zmrClient.searchItSpecific(fakeTaxNumber)).thenReturn(zmrResultSpecific);
 
-    //Mock ernb initial search
-    ArrayList<RegisterResult> ernbResultInitial = new ArrayList<>();
-    ernbClient = Mockito.mock(IErnbClient.class);
-    Mockito.when(ernbClient.searchWithPersonIdentifer(randomIdentifier)).thenReturn(ernbResultInitial);
+    ArrayList<RegisterResult> ernpResultInitial = new ArrayList<>();
+    ernpClient = Mockito.mock(IErnpClient.class);
+    Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(ernpResultInitial);
 
-    //Mock country specific search
-    List<ICountrySpecificDetailSearchProcessor> handlers = new ArrayList<>();
-    ItSpecificDetailSearchProcessor it = new ItSpecificDetailSearchProcessor(ernbClient, zmrClient);
+    List<CountrySpecificDetailSearchProcessor> handlers = new ArrayList<>();
+    ItSpecificDetailSearchProcessor it = new ItSpecificDetailSearchProcessor(ernpClient, zmrClient);
     handlers.add(it);
-    task = new InitialSearchTask(handlers, ernbClient, zmrClient);
+    task = new InitialSearchTask(handlers, ernpClient, zmrClient);
 
     try {
       task.execute(pendingReq1, executionContext);
-
       Assert.assertTrue("Wrong workflow, should not reach this point/ get a bpk", false);
-
     } catch (final TaskExecutionException e) {
       Throwable origE = e.getOriginalException();
       Assert.assertTrue("Wrong exception", (origE.getCause() instanceof ManualFixNecessaryException));
@@ -497,45 +475,35 @@ public class InitialSearchTaskFirstTest {
   @Test
   @DirtiesContext
   /**
-   * NO match found in ZMR and ErnB with Initial search
+   * NO match found in ZMR and ErnP with Initial search
    */
-  public void testNode105() {
+  public void testNode105_TemporaryEnd() throws TaskExecutionException {
 
-    //Mock ZMR
     ArrayList<RegisterResult> zmrResult = new ArrayList<>();
     zmrClient = Mockito.mock(IZmrClient.class);
-    Mockito.when(zmrClient.searchWithPersonIdentifer(randomIdentifier)).thenReturn(zmrResult);
-
-    //Mock ernb
-    ArrayList<RegisterResult> ernbResult = new ArrayList<>();
-    ernbClient = Mockito.mock(IErnbClient.class);
-    Mockito.when(ernbClient.searchWithPersonIdentifer(randomIdentifier)).thenReturn(ernbResult);
+    Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(zmrResult);
 
-    task = new InitialSearchTask(emptyHandlers(), ernbClient, zmrClient);
-    try {
-      task.execute(pendingReq, executionContext);
+    ArrayList<RegisterResult> ernpResult = new ArrayList<>();
+    ernpClient = Mockito.mock(IErnpClient.class);
+    Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(ernpResult);
 
-      String bPk = (String)
-          pendingReq.getSessionData(AuthProcessDataWrapper.class).getGenericDataFromSession(Constants.DATA_RESULT_MATCHING_BPK);
-      Assert.assertTrue("Wrong bpk", bPk.equals("TODO-Temporary-Endnode-105"));
-    } catch (final TaskExecutionException e) {
-      Assert.assertTrue("Wrong workflow, should not reach this point", false);
-    }
+    task = new InitialSearchTask(emptyHandlers(), ernpClient, zmrClient);
+    task.execute(pendingReq, executionContext);
+    String bPk = (String)
+        pendingReq.getSessionData(AuthProcessDataWrapper.class).getGenericDataFromSession(Constants.DATA_RESULT_MATCHING_BPK);
+    Assert.assertEquals("Wrong bpk", "TODO-Temporary-Endnode-105", bPk);
   }
 
 
   @NotNull
   private AuthenticationResponse buildDummyAuthResponseRandomPerson() throws URISyntaxException {
-    // NOTE: Those strings "de/st/max123" seem to be somehow relevant, but where do we need to use that exact string
-    // again?
-    // NOTE: If not, why not using random strings?
     return buildDummyAuthResponse(randomGivenName, randomFamilyName,
-        "de/st/"+randomIdentifier, "2011-01-01");
+        DE_ST+randomIdentifier, randomDate);
   }
 
   private AuthenticationResponse buildDummyAuthResponseRandomPersonIT_Tax(String taxNumber) throws URISyntaxException {
     return buildDummyAuthResponse(randomGivenName, randomFamilyName,
-        "it/st/"+randomIdentifier, "2011-01-01", taxNumber, null, null);
+        IT_ST+randomIdentifier, randomDate, taxNumber, null, null);
   }
 
   @NotNull
@@ -555,58 +523,46 @@ public class InitialSearchTaskFirstTest {
   private AuthenticationResponse buildDummyAuthResponse(String givenName, String familyName, String identifier,
                                                         String dateOfBirth, String taxNumber, String placeOfBirth,
                                                         String birthName) throws URISyntaxException {
-    final AttributeDefinition attributeDef = AttributeDefinition.builder()
-        .friendlyName(Constants.eIDAS_ATTR_PERSONALIDENTIFIER).nameUri(new URI("ad", "sd", "ff"))
-        .personType(PersonType.LEGAL_PERSON).xmlType(new QName("http://saf", "as", "af"))
-        .attributeValueMarshaller("eu.eidas.auth.commons.attribute.impl.LiteralStringAttributeValueMarshaller").build();
-    final AttributeDefinition attributeDef2 = AttributeDefinition.builder()
-        .friendlyName(Constants.eIDAS_ATTR_CURRENTFAMILYNAME).nameUri(new URI("ad", "sd", "fff"))
-        .personType(PersonType.LEGAL_PERSON).xmlType(new QName("http://saf", "as", "aff"))
-        .attributeValueMarshaller("eu.eidas.auth.commons.attribute.impl.LiteralStringAttributeValueMarshaller").build();
-    final AttributeDefinition attributeDef3 = AttributeDefinition.builder()
-        .friendlyName(Constants.eIDAS_ATTR_CURRENTGIVENNAME).nameUri(new URI("ad", "sd", "ffff"))
-        .personType(PersonType.LEGAL_PERSON).xmlType(new QName("http://saf", "as", "afff"))
-        .attributeValueMarshaller("eu.eidas.auth.commons.attribute.impl.LiteralStringAttributeValueMarshaller").build();
-    final AttributeDefinition attributeDef4 = AttributeDefinition.builder()
-        .friendlyName(Constants.eIDAS_ATTR_DATEOFBIRTH).nameUri(new URI("ad", "sd", "fffff"))
-        .personType(PersonType.LEGAL_PERSON).xmlType(new QName("http://saf", "as", "affff"))
-        .attributeValueMarshaller("eu.eidas.auth.commons.attribute.impl.DateTimeAttributeValueMarshaller").build();
-    final AttributeDefinition attributeDef5 = AttributeDefinition.builder()
-        .friendlyName(Constants.eIDAS_ATTR_TAXREFERENCE).nameUri(new URI("ad", "sd", "ffffff"))
-        .personType(PersonType.LEGAL_PERSON).xmlType(new QName("http://saf", "as", "afffff"))
-        .attributeValueMarshaller("eu.eidas.auth.commons.attribute.impl.LiteralStringAttributeValueMarshaller").build();
-    final AttributeDefinition attributeDef6 = AttributeDefinition.builder()
-        .friendlyName(Constants.eIDAS_ATTR_PLACEOFBIRTH).nameUri(new URI("ad", "sd", "fffffff"))
-        .personType(PersonType.LEGAL_PERSON).xmlType(new QName("http://saf", "as", "affffff"))
-        .attributeValueMarshaller("eu.eidas.auth.commons.attribute.impl.LiteralStringAttributeValueMarshaller").build();
-    final AttributeDefinition attributeDef7 = AttributeDefinition.builder()
-        .friendlyName(Constants.eIDAS_ATTR_BIRTHNAME).nameUri(new URI("ad", "sd", "ffffffff"))
-        .personType(PersonType.LEGAL_PERSON).xmlType(new QName("http://saf", "as", "afffffff"))
-        .attributeValueMarshaller("eu.eidas.auth.commons.attribute.impl.LiteralStringAttributeValueMarshaller").build();
     ImmutableAttributeMap.Builder builder = ImmutableAttributeMap.builder()
-        .put(attributeDef, identifier)
-        .put(attributeDef2, familyName)
-        .put(attributeDef3, givenName)
-        .put(attributeDef4, dateOfBirth);
-
+        .put(generateStringAttribute(Constants.eIDAS_ATTR_PERSONALIDENTIFIER,"ff","af"), identifier)
+        .put(generateStringAttribute(Constants.eIDAS_ATTR_CURRENTFAMILYNAME,"fff","aff"), familyName)
+        .put(generateStringAttribute(Constants.eIDAS_ATTR_CURRENTGIVENNAME,"ffff","afff"), givenName)
+        .put(generateDateTimeAttribute(Constants.eIDAS_ATTR_DATEOFBIRTH,"fffff","affff"), dateOfBirth);
     if (taxNumber != null) {
-      builder.put(attributeDef5, taxNumber);
+      builder.put(generateStringAttribute(Constants.eIDAS_ATTR_TAXREFERENCE,"ffffff","afffff"), taxNumber);
     }
     if (birthName != null) {
-      builder.put(attributeDef7, birthName);
+      builder.put(generateStringAttribute(Constants.eIDAS_ATTR_BIRTHNAME,"fffffff","affffff"), birthName);
     }
     if (placeOfBirth != null) {
-      builder.put(attributeDef6, placeOfBirth);
+      builder.put(generateStringAttribute(Constants.eIDAS_ATTR_PLACEOFBIRTH,"ffffffff","afffffff"), placeOfBirth);
     }
     final ImmutableAttributeMap attributeMap = builder.build();
 
     val b = new AuthenticationResponse.Builder();
     return b.id("aasdf").issuer("asd").subject("asf").statusCode("200").inResponseTo("asdf").subjectNameIdFormat(
-        "afaf")
-        .attributes(attributeMap).build();
+        "afaf").attributes(attributeMap).build();
+  }
+
+  private AttributeDefinition generateStringAttribute(String friendlyName, String fragment, String prefix) throws URISyntaxException {
+    return generateAttribute(friendlyName, fragment, prefix, "eu.eidas.auth.commons.attribute.impl" +
+        ".LiteralStringAttributeValueMarshaller");
+  }
+
+  private AttributeDefinition generateDateTimeAttribute(String friendlyName, String fragment, String prefix) throws URISyntaxException {
+    return generateAttribute(friendlyName, fragment, prefix, "eu.eidas.auth.commons.attribute.impl" +
+        ".DateTimeAttributeValueMarshaller");
+  }
+
+  private AttributeDefinition generateAttribute(String friendlyName, String fragment, String prefix,
+                                                String marshaller) throws URISyntaxException {
+    return AttributeDefinition.builder()
+        .friendlyName(friendlyName).nameUri(new URI("ad", "sd", fragment))
+        .personType(PersonType.LEGAL_PERSON).xmlType(new QName("http://saf", "as", prefix))
+        .attributeValueMarshaller(marshaller).build();
   }
 
-  private List<ICountrySpecificDetailSearchProcessor> emptyHandlers() {
+  private List<CountrySpecificDetailSearchProcessor> emptyHandlers() {
     return new ArrayList<>();
   }
 
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/resources/SpringTest-context_tasks_test.xml b/eidas_modules/authmodule-eIDAS-v2/src/test/resources/SpringTest-context_tasks_test.xml
index 10d480e0..1f3a984b 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/test/resources/SpringTest-context_tasks_test.xml
+++ b/eidas_modules/authmodule-eIDAS-v2/src/test/resources/SpringTest-context_tasks_test.xml
@@ -66,7 +66,7 @@
         scope="prototype" />
 
   <bean id="ErnbClientForeIDAS"
-        class="at.asitplus.eidas.specific.modules.auth.eidas.v2.ernb.DummyErnbClient" />
+        class="at.asitplus.eidas.specific.modules.auth.eidas.v2.ernp.DummyErnpClient" />
 
   <bean id="ZmrClientForeIDAS"
         class="at.asitplus.eidas.specific.modules.auth.eidas.v2.zmr.DummyZmrClient" />
-- 
cgit v1.2.3


From b0f2b00b460e1c8419ea631bdbd1da1c33150bce Mon Sep 17 00:00:00 2001
From: Christian Kollmann <christian.kollmann@a-sit.at>
Date: Tue, 12 Jan 2021 14:17:52 +0100
Subject: Streamline mock creation in tests

---
 .../v2/test/tasks/InitialSearchTaskFirstTest.java  | 53 +++-------------------
 1 file changed, 7 insertions(+), 46 deletions(-)

diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskFirstTest.java b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskFirstTest.java
index a1dce0f2..12a0969d 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskFirstTest.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskFirstTest.java
@@ -50,7 +50,9 @@ import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.runner.RunWith;
+import org.mockito.Mock;
 import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
 import org.springframework.mock.web.MockHttpServletRequest;
 import org.springframework.mock.web.MockHttpServletResponse;
 import org.springframework.test.annotation.DirtiesContext;
@@ -69,13 +71,14 @@ import java.util.List;
 import java.util.Random;
 
 @RunWith(SpringJUnit4ClassRunner.class)
-
 @ContextConfiguration("/SpringTest-context_tasks_test.xml")
 @DirtiesContext(classMode = ClassMode.BEFORE_CLASS)
 public class InitialSearchTaskFirstTest {
 
   private InitialSearchTask task;
+  @Mock
   private IZmrClient zmrClient;
+  @Mock
   private IErnpClient ernpClient;
 
   final ExecutionContext executionContext = new ExecutionContextImpl();
@@ -108,6 +111,9 @@ public class InitialSearchTaskFirstTest {
    */
   @Before
   public void setUp() throws URISyntaxException, EaafStorageException {
+    MockitoAnnotations.initMocks(this);
+    task = new InitialSearchTask(new ArrayList<CountrySpecificDetailSearchProcessor>(), ernpClient, zmrClient);
+
     httpReq = new MockHttpServletRequest("POST", "https://localhost/authhandler");
     httpResp = new MockHttpServletResponse();
     RequestContextHolder.resetRequestAttributes();
@@ -125,20 +131,15 @@ public class InitialSearchTaskFirstTest {
    * One match, but register update needed
    */
   public void testNode100_UserIdentifiedUpdateNecessary_a() throws Exception {
-
     ArrayList<RegisterResult> zmrResult = new ArrayList<>();
     String randomBpk = RandomStringUtils.randomNumeric(6);
     String newFirstName = RandomStringUtils.randomAlphabetic(5);
     zmrResult.add(new RegisterResult(randomBpk, DE_ST+randomIdentifier, newFirstName, randomFamilyName, randomDate));
-
-    zmrClient = Mockito.mock(IZmrClient.class);
     Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(zmrResult);
 
     ArrayList<RegisterResult> ernpResult = new ArrayList<>();
-    ernpClient = Mockito.mock(IErnpClient.class);
     Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(ernpResult);
 
-    task = new InitialSearchTask(emptyHandlers(), ernpClient, zmrClient);
     task.execute(pendingReq, executionContext);
     String bPk = (String)
         pendingReq.getSessionData(AuthProcessDataWrapper.class).getGenericDataFromSession(Constants.DATA_RESULT_MATCHING_BPK);
@@ -151,20 +152,14 @@ public class InitialSearchTaskFirstTest {
    * One match, but register update needed
    */
   public void testNode100_UserIdentifiedUpdateNecessary_b() throws TaskExecutionException {
-
     ArrayList<RegisterResult> zmrResult = new ArrayList<>();
-
-    zmrClient = Mockito.mock(IZmrClient.class);
     Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(zmrResult);
 
     ArrayList<RegisterResult> ernpResult = new ArrayList<>();
     String randomBpk = RandomStringUtils.randomNumeric(6);
     ernpResult.add(new RegisterResult(randomBpk, DE_ST+randomIdentifier, "Max_new", randomFamilyName, randomDate));
-
-    ernpClient = Mockito.mock(IErnpClient.class);
     Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(ernpResult);
 
-    task = new InitialSearchTask(emptyHandlers(), ernpClient, zmrClient);
     task.execute(pendingReq, executionContext);
     String bPk = (String)
         pendingReq.getSessionData(AuthProcessDataWrapper.class).getGenericDataFromSession(Constants.DATA_RESULT_MATCHING_BPK);
@@ -179,18 +174,14 @@ public class InitialSearchTaskFirstTest {
    * Two matches found in ZMR
    */
   public void testNode101_ManualFixNecessary_a() throws Exception {
-
     ArrayList<RegisterResult> zmrResult = new ArrayList<>();
     zmrResult.add(new RegisterResult("bpkMax", DE_ST+randomIdentifier, randomGivenName, randomFamilyName, randomDate));
     zmrResult.add(new RegisterResult("bpkMax", DE_ST+randomIdentifier, "Maximilian", randomFamilyName, randomDate));
-    zmrClient = Mockito.mock(IZmrClient.class);
     Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(zmrResult);
 
     ArrayList<RegisterResult> ernpResult = new ArrayList<>();
-    ernpClient = Mockito.mock(IErnpClient.class);
     Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(ernpResult);
 
-    task = new InitialSearchTask(emptyHandlers(), ernpClient, zmrClient);
     try {
       task.execute(pendingReq, executionContext);
       Assert.assertTrue("Wrong workflow, should not reach this point/ get a bpk", false);
@@ -209,7 +200,6 @@ public class InitialSearchTaskFirstTest {
   public void testNode101_ManualFixNecessary_b() throws Exception {
     String randombpk = RandomStringUtils.random(5);
     ArrayList<RegisterResult> zmrResult = new ArrayList<>();
-    zmrClient = Mockito.mock(IZmrClient.class);
     Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(zmrResult);
 
     ArrayList<RegisterResult> ernpResult = new ArrayList<>();
@@ -217,11 +207,8 @@ public class InitialSearchTaskFirstTest {
     ernpResult.add(new RegisterResult(randombpk, DE_ST+randomIdentifier, randomGivenName+RandomStringUtils.random(2),
         randomFamilyName,
         randomDate));
-
-    ernpClient = Mockito.mock(IErnpClient.class);
     Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(ernpResult);
 
-    task = new InitialSearchTask(emptyHandlers(), ernpClient, zmrClient);
     try {
       task.execute(pendingReq, executionContext);
       Assert.assertTrue("Wrong workflow, should not reach this point/ get a bpk", false);
@@ -237,19 +224,14 @@ public class InitialSearchTaskFirstTest {
    * One match, no register update needed
    */
   public void testNode102_UserIdentified_a() throws Exception {
-
     String randomBpk = RandomStringUtils.randomNumeric(12);
     ArrayList<RegisterResult> zmrResult = new ArrayList<>();
-    zmrClient = Mockito.mock(IZmrClient.class);
     Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(zmrResult);
 
     ArrayList<RegisterResult> ernpResult = new ArrayList<>();
     ernpResult.add(new RegisterResult(randomBpk, DE_ST+randomIdentifier, randomGivenName, randomFamilyName, randomDate));
-
-    ernpClient = Mockito.mock(IErnpClient.class);
     Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(ernpResult);
 
-    task = new InitialSearchTask(emptyHandlers(), ernpClient, zmrClient);
     task.execute(pendingReq, executionContext);
     String bPk = (String)
         pendingReq.getSessionData(AuthProcessDataWrapper.class).getGenericDataFromSession(Constants.DATA_RESULT_MATCHING_BPK);
@@ -266,16 +248,11 @@ public class InitialSearchTaskFirstTest {
 
     ArrayList<RegisterResult> zmrResult = new ArrayList<>();
     zmrResult.add(new RegisterResult(randomBpk, DE_ST+randomIdentifier, randomGivenName, randomFamilyName, randomDate));
-
-    zmrClient = Mockito.mock(IZmrClient.class);
     Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(zmrResult);
 
     ArrayList<RegisterResult> ernpResult = new ArrayList<>();
-
-    ernpClient = Mockito.mock(IErnpClient.class);
     Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(ernpResult);
 
-    task = new InitialSearchTask(emptyHandlers(), ernpClient, zmrClient);
     task.execute(pendingReq, executionContext);
     String bPk = (String)
         pendingReq.getSessionData(AuthProcessDataWrapper.class).getGenericDataFromSession(Constants.DATA_RESULT_MATCHING_BPK);
@@ -296,7 +273,6 @@ public class InitialSearchTaskFirstTest {
         .setGenericDataToSession(Constants.DATA_FULL_EIDAS_RESPONSE, response);
 
     ArrayList<RegisterResult> zmrResultInitial = new ArrayList<>();
-    zmrClient = Mockito.mock(IZmrClient.class);
     Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(zmrResultInitial);
     ArrayList<RegisterResult> zmrResultSpecific = new ArrayList<>();
 
@@ -308,7 +284,6 @@ public class InitialSearchTaskFirstTest {
     Mockito.when(zmrClient.searchItSpecific(taxNumber)).thenReturn(zmrResultSpecific);
 
     ArrayList<RegisterResult> ernpResultInitial = new ArrayList<>();
-    ernpClient = Mockito.mock(IErnpClient.class);
     Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(ernpResultInitial);
 
     List<CountrySpecificDetailSearchProcessor> handlers = new ArrayList<>();
@@ -347,7 +322,6 @@ public class InitialSearchTaskFirstTest {
         .setGenericDataToSession(Constants.DATA_FULL_EIDAS_RESPONSE, response);
 
     ArrayList<RegisterResult> zmrResultInitial = new ArrayList<>();
-    zmrClient = Mockito.mock(IZmrClient.class);
     Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(zmrResultInitial);
     ArrayList<RegisterResult> zmrResultSpecific = new ArrayList<>();
 
@@ -358,7 +332,6 @@ public class InitialSearchTaskFirstTest {
     Mockito.when(zmrClient.searchDeSpecific(givenName, familyName, dateOfBirth, placeOfBirth, birthName)).thenReturn(zmrResultSpecific);
 
     ArrayList<RegisterResult> ernpResultInitial = new ArrayList<>();
-    ernpClient = Mockito.mock(IErnpClient.class);
     Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(ernpResultInitial);
 
     List<CountrySpecificDetailSearchProcessor> handlers = new ArrayList<>();
@@ -399,7 +372,6 @@ public class InitialSearchTaskFirstTest {
         .setGenericDataToSession(Constants.DATA_FULL_EIDAS_RESPONSE, response);
 
     ArrayList<RegisterResult> zmrResultInitial = new ArrayList<>();
-    zmrClient = Mockito.mock(IZmrClient.class);
     Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(zmrResultInitial);
     ArrayList<RegisterResult> zmrResultSpecific = new ArrayList<>();
 
@@ -412,7 +384,6 @@ public class InitialSearchTaskFirstTest {
     Mockito.when(zmrClient.searchDeSpecific(givenName, familyName, dateOfBirth, placeOfBirth, birthName)).thenReturn(zmrResultSpecific);
 
     ArrayList<RegisterResult> ernpResultInitial = new ArrayList<>();
-    ernpClient = Mockito.mock(IErnpClient.class);
     Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(ernpResultInitial);
 
     List<CountrySpecificDetailSearchProcessor> handlers = new ArrayList<>();
@@ -442,7 +413,6 @@ public class InitialSearchTaskFirstTest {
         .setGenericDataToSession(Constants.DATA_FULL_EIDAS_RESPONSE, response);
 
     ArrayList<RegisterResult> zmrResultInitial = new ArrayList<>();
-    zmrClient = Mockito.mock(IZmrClient.class);
     Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(zmrResultInitial);
     ArrayList<RegisterResult> zmrResultSpecific = new ArrayList<>();
 
@@ -455,7 +425,6 @@ public class InitialSearchTaskFirstTest {
     Mockito.when(zmrClient.searchItSpecific(fakeTaxNumber)).thenReturn(zmrResultSpecific);
 
     ArrayList<RegisterResult> ernpResultInitial = new ArrayList<>();
-    ernpClient = Mockito.mock(IErnpClient.class);
     Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(ernpResultInitial);
 
     List<CountrySpecificDetailSearchProcessor> handlers = new ArrayList<>();
@@ -478,16 +447,12 @@ public class InitialSearchTaskFirstTest {
    * NO match found in ZMR and ErnP with Initial search
    */
   public void testNode105_TemporaryEnd() throws TaskExecutionException {
-
     ArrayList<RegisterResult> zmrResult = new ArrayList<>();
-    zmrClient = Mockito.mock(IZmrClient.class);
     Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(zmrResult);
 
     ArrayList<RegisterResult> ernpResult = new ArrayList<>();
-    ernpClient = Mockito.mock(IErnpClient.class);
     Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(ernpResult);
 
-    task = new InitialSearchTask(emptyHandlers(), ernpClient, zmrClient);
     task.execute(pendingReq, executionContext);
     String bPk = (String)
         pendingReq.getSessionData(AuthProcessDataWrapper.class).getGenericDataFromSession(Constants.DATA_RESULT_MATCHING_BPK);
@@ -562,8 +527,4 @@ public class InitialSearchTaskFirstTest {
         .attributeValueMarshaller(marshaller).build();
   }
 
-  private List<CountrySpecificDetailSearchProcessor> emptyHandlers() {
-    return new ArrayList<>();
-  }
-
 }
-- 
cgit v1.2.3


From 5a6df04af0db1a3d66b447da35bf9ad28a371281 Mon Sep 17 00:00:00 2001
From: Christian Kollmann <christian.kollmann@a-sit.at>
Date: Tue, 12 Jan 2021 14:18:29 +0100
Subject: Fix typo

---
 .../auth/eidas/v2/utils/EidasResponseUtils.java    | 24 +++++++++++-----------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/utils/EidasResponseUtils.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/utils/EidasResponseUtils.java
index fb223ee7..3cf73944 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/utils/EidasResponseUtils.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/utils/EidasResponseUtils.java
@@ -54,7 +54,7 @@ public class EidasResponseUtils {
   /**
    * Validate a eIDAS PersonalIdentifier attribute value This validation is done
    * according to eIDAS SAML Attribute Profile - Section 2.2.3 Unique Identifier
-   * 
+   *
    * @param uniqueID eIDAS attribute value of a unique identifier
    * @return true if the uniqueID matches to eIDAS to Unique Identifier
    *         specification, otherwise false
@@ -70,9 +70,9 @@ public class EidasResponseUtils {
    * Parse an eIDAS PersonalIdentifier attribute value into it components. This
    * processing is done according to eIDAS SAML Attribute Profile - Section 2.2.3
    * Unique Identifier
-   * 
+   *
    * @param uniqueID eIDAS attribute value of a unique identifier
-   * @return {@link Trible} that contains: <br>
+   * @return {@link Triple} that contains: <br>
    *         First : citizen country <br>
    *         Second: destination country <br>
    *         Third : unique identifier <br>
@@ -80,7 +80,7 @@ public class EidasResponseUtils {
    */
   public static Triple<String, String, String> parseEidasPersonalIdentifier(String uniqueID) {
     if (!validateEidasPersonalIdentifier(uniqueID)) {
-      log.error("eIDAS attribute value for {} looks wrong formated. Value: {}", 
+      log.error("eIDAS attribute value for {} looks wrong formated. Value: {}",
           Constants.eIDAS_ATTR_PERSONALIDENTIFIER, uniqueID);
       return null;
 
@@ -90,11 +90,11 @@ public class EidasResponseUtils {
   }
 
   /**
-   * Get eIDAS attribute-values from eIDAS Node attributes. 
-   * 
+   * Get eIDAS attribute-values from eIDAS Node attributes.
+   *
    * @param attributeDefinition eIDAS attribute definition
    * @param attributeValues Attributes from eIDAS response
-   * @return Set of attribute values. If more then one value than the first value contains the 'Latin' value. 
+   * @return Set of attribute values. If more then one value than the first value contains the 'Latin' value.
    */
   // TODO: check possible problem with nonLatinCharacters
   public static List<String> translateStringListAttribute(AttributeDefinition<?> attributeDefinition,
@@ -109,7 +109,7 @@ public class EidasResponseUtils {
 
         log.trace("Find attr: {} with value: {} nonLatinFlag: {} needTransliteration: {}",
             attributeDefinition.getFriendlyName(), attributeValue.toString(),
-            attributeValue.isNonLatinScriptAlternateVersion(), 
+            attributeValue.isNonLatinScriptAlternateVersion(),
             AttributeValueTransliterator.needsTransliteration(valueString));
 
         // if (attributeValue.isNonLatinScriptAlternateVersion()) {
@@ -128,7 +128,7 @@ public class EidasResponseUtils {
       }
     }
 
-    log.trace("Extract values: {} for attr: {}", 
+    log.trace("Extract values: {} for attr: {}",
         StringUtils.join(stringListAttribute, ","), attributeDefinition.getFriendlyName());
 
     return stringListAttribute;
@@ -136,8 +136,8 @@ public class EidasResponseUtils {
   }
 
   /**
-   * Convert eIDAS DateTime attribute to Java Object. 
-   * 
+   * Convert eIDAS DateTime attribute to Java Object.
+   *
    * @param attributeDefinition eIDAS attribute definition.
    * @param attributeValues eIDAS attribute value
    * @return
@@ -156,7 +156,7 @@ public class EidasResponseUtils {
 
   /**
    * Concert eIDAS Address attribute to Java object.
-   * 
+   *
    * @param attributeDefinition eIDAS attribute definition
    * @param attributeValues eIDAS attribute value
    * @return
-- 
cgit v1.2.3


From 50c82048f034803a3486368d2c5cb3ad09eb07b3 Mon Sep 17 00:00:00 2001
From: Christian Kollmann <christian.kollmann@a-sit.at>
Date: Tue, 12 Jan 2021 15:00:43 +0100
Subject: Improve readability of test cases by using modern syntax

---
 .../v2/test/tasks/InitialSearchTaskFirstTest.java  | 151 +++++++++------------
 1 file changed, 67 insertions(+), 84 deletions(-)

diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskFirstTest.java b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskFirstTest.java
index 12a0969d..35e2e56e 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskFirstTest.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskFirstTest.java
@@ -70,6 +70,8 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.Random;
 
+import static org.junit.Assert.assertThrows;
+
 @RunWith(SpringJUnit4ClassRunner.class)
 @ContextConfiguration("/SpringTest-context_tasks_test.xml")
 @DirtiesContext(classMode = ClassMode.BEFORE_CLASS)
@@ -82,17 +84,15 @@ public class InitialSearchTaskFirstTest {
   private IErnpClient ernpClient;
 
   final ExecutionContext executionContext = new ExecutionContextImpl();
-  private MockHttpServletRequest httpReq;
-  private MockHttpServletResponse httpResp;
   private TestRequestImpl pendingReq;
-  private String randomIdentifier = RandomStringUtils.randomNumeric(10);
-  private String randomFamilyName = RandomStringUtils.randomNumeric(11);
-  private String randomGivenName = RandomStringUtils.randomNumeric(12);
-  private String randomPlaceOfBirth = RandomStringUtils.randomNumeric(12);
-  private String randomBirthName = RandomStringUtils.randomNumeric(12);
-  private String randomDate = "2011-01-"+ (10 + new Random().nextInt(18));
-  private String DE_ST = "de/st/";
-  private String IT_ST = "it/st/";
+  private final String randomIdentifier = RandomStringUtils.randomNumeric(10);
+  private final String randomFamilyName = RandomStringUtils.randomNumeric(11);
+  private final String randomGivenName = RandomStringUtils.randomNumeric(12);
+  private final String randomPlaceOfBirth = RandomStringUtils.randomNumeric(12);
+  private final String randomBirthName = RandomStringUtils.randomNumeric(12);
+  private final String randomDate = "2011-01-"+ (10 + new Random().nextInt(18));
+  private final String DE_ST = "de/st/";
+  private final String IT_ST = "it/st/";
 
   /**
    * jUnit class initializer.
@@ -112,10 +112,10 @@ public class InitialSearchTaskFirstTest {
   @Before
   public void setUp() throws URISyntaxException, EaafStorageException {
     MockitoAnnotations.initMocks(this);
-    task = new InitialSearchTask(new ArrayList<CountrySpecificDetailSearchProcessor>(), ernpClient, zmrClient);
+    task = new InitialSearchTask(new ArrayList<>(), ernpClient, zmrClient);
 
-    httpReq = new MockHttpServletRequest("POST", "https://localhost/authhandler");
-    httpResp = new MockHttpServletResponse();
+    MockHttpServletRequest httpReq = new MockHttpServletRequest("POST", "https://localhost/authhandler");
+    MockHttpServletResponse httpResp = new MockHttpServletResponse();
     RequestContextHolder.resetRequestAttributes();
     RequestContextHolder.setRequestAttributes(new ServletRequestAttributes(httpReq, httpResp));
 
@@ -125,11 +125,11 @@ public class InitialSearchTaskFirstTest {
         .setGenericDataToSession(Constants.DATA_FULL_EIDAS_RESPONSE, response);
   }
 
-  @Test
-  @DirtiesContext
   /**
    * One match, but register update needed
    */
+  @Test
+  @DirtiesContext
   public void testNode100_UserIdentifiedUpdateNecessary_a() throws Exception {
     ArrayList<RegisterResult> zmrResult = new ArrayList<>();
     String randomBpk = RandomStringUtils.randomNumeric(6);
@@ -143,14 +143,14 @@ public class InitialSearchTaskFirstTest {
     task.execute(pendingReq, executionContext);
     String bPk = (String)
         pendingReq.getSessionData(AuthProcessDataWrapper.class).getGenericDataFromSession(Constants.DATA_RESULT_MATCHING_BPK);
-    Assert.assertTrue("Wrong bpk", bPk.equals(randomBpk));
+    Assert.assertEquals("Wrong bpk", bPk, randomBpk);
   }
 
-  @Test
-  @DirtiesContext
   /**
    * One match, but register update needed
    */
+  @Test
+  @DirtiesContext
   public void testNode100_UserIdentifiedUpdateNecessary_b() throws TaskExecutionException {
     ArrayList<RegisterResult> zmrResult = new ArrayList<>();
     Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(zmrResult);
@@ -163,17 +163,16 @@ public class InitialSearchTaskFirstTest {
     task.execute(pendingReq, executionContext);
     String bPk = (String)
         pendingReq.getSessionData(AuthProcessDataWrapper.class).getGenericDataFromSession(Constants.DATA_RESULT_MATCHING_BPK);
-    Assert.assertTrue("Wrong bpk", bPk.equals(randomBpk));
-
+    Assert.assertEquals("Wrong bpk", bPk, randomBpk);
   }
 
 
-  @Test
-  @DirtiesContext
   /**
    * Two matches found in ZMR
    */
-  public void testNode101_ManualFixNecessary_a() throws Exception {
+  @Test
+  @DirtiesContext
+  public void testNode101_ManualFixNecessary_a() {
     ArrayList<RegisterResult> zmrResult = new ArrayList<>();
     zmrResult.add(new RegisterResult("bpkMax", DE_ST+randomIdentifier, randomGivenName, randomFamilyName, randomDate));
     zmrResult.add(new RegisterResult("bpkMax", DE_ST+randomIdentifier, "Maximilian", randomFamilyName, randomDate));
@@ -182,22 +181,19 @@ public class InitialSearchTaskFirstTest {
     ArrayList<RegisterResult> ernpResult = new ArrayList<>();
     Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(ernpResult);
 
-    try {
-      task.execute(pendingReq, executionContext);
-      Assert.assertTrue("Wrong workflow, should not reach this point/ get a bpk", false);
-    } catch (final TaskExecutionException e) {
-      Throwable origE = e.getOriginalException();
-      Assert.assertTrue("Wrong exception", (origE.getCause() instanceof ManualFixNecessaryException));
-    }
+    TaskExecutionException exception = assertThrows(TaskExecutionException.class,
+            () -> task.execute(pendingReq, executionContext));
+    Throwable origE = exception.getOriginalException();
+    Assert.assertTrue("Wrong exception", (origE.getCause() instanceof ManualFixNecessaryException));
   }
 
 
-  @Test
-  @DirtiesContext
   /**
    * Two matches found in ErnP
    */
-  public void testNode101_ManualFixNecessary_b() throws Exception {
+  @Test
+  @DirtiesContext
+  public void testNode101_ManualFixNecessary_b() {
     String randombpk = RandomStringUtils.random(5);
     ArrayList<RegisterResult> zmrResult = new ArrayList<>();
     Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(zmrResult);
@@ -209,20 +205,17 @@ public class InitialSearchTaskFirstTest {
         randomDate));
     Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(ernpResult);
 
-    try {
-      task.execute(pendingReq, executionContext);
-      Assert.assertTrue("Wrong workflow, should not reach this point/ get a bpk", false);
-    } catch (final TaskExecutionException e) {
-      Throwable origE = e.getOriginalException();
-      Assert.assertTrue("Wrong exception", (origE.getCause() instanceof ManualFixNecessaryException));
-    }
+    TaskExecutionException exception = assertThrows(TaskExecutionException.class,
+            () -> task.execute(pendingReq, executionContext));
+    Throwable origE = exception.getOriginalException();
+    Assert.assertTrue("Wrong exception", (origE.getCause() instanceof ManualFixNecessaryException));
   }
 
-  @Test
-  @DirtiesContext
   /**
    * One match, no register update needed
    */
+  @Test
+  @DirtiesContext
   public void testNode102_UserIdentified_a() throws Exception {
     String randomBpk = RandomStringUtils.randomNumeric(12);
     ArrayList<RegisterResult> zmrResult = new ArrayList<>();
@@ -235,14 +228,14 @@ public class InitialSearchTaskFirstTest {
     task.execute(pendingReq, executionContext);
     String bPk = (String)
         pendingReq.getSessionData(AuthProcessDataWrapper.class).getGenericDataFromSession(Constants.DATA_RESULT_MATCHING_BPK);
-    Assert.assertTrue("Wrong bpk", bPk.equals(randomBpk));
+    Assert.assertEquals("Wrong bpk", bPk, randomBpk);
   }
 
-  @Test
-  @DirtiesContext
   /**
    * One match, no register update needed
    */
+  @Test
+  @DirtiesContext
   public void testNode102_UserIdentified_b() throws Exception {
     String randomBpk = RandomStringUtils.randomNumeric(14);
 
@@ -256,14 +249,14 @@ public class InitialSearchTaskFirstTest {
     task.execute(pendingReq, executionContext);
     String bPk = (String)
         pendingReq.getSessionData(AuthProcessDataWrapper.class).getGenericDataFromSession(Constants.DATA_RESULT_MATCHING_BPK);
-    Assert.assertTrue("Wrong bpk", bPk.equals(randomBpk));
+    Assert.assertEquals("Wrong bpk", bPk, randomBpk);
   }
 
-  @Test
-  @DirtiesContext
   /**
    * One match found in ZMR and ErnP with detail search
    */
+  @Test
+  @DirtiesContext
   public void testNode103_UserIdentified_IT() throws Exception {
     String bpkRegister = RandomStringUtils.randomNumeric(14);
     String taxNumber = RandomStringUtils.randomNumeric(14);
@@ -291,22 +284,18 @@ public class InitialSearchTaskFirstTest {
     handlers.add(it);
     task = new InitialSearchTask(handlers, ernpClient, zmrClient);
 
-    try {
-      task.execute(pendingReq1, executionContext);
+    task.execute(pendingReq1, executionContext);
 
-      String bPk = (String)
-          pendingReq1.getSessionData(AuthProcessDataWrapper.class).getGenericDataFromSession(Constants.DATA_RESULT_MATCHING_BPK);
-      Assert.assertTrue("Wrong bpk", bPk.equals(bpkRegister));
-    } catch (final TaskExecutionException e) {
-      Assert.assertTrue("Wrong workflow, should not reach this point", false);
-    }
+    String bPk = (String)
+        pendingReq1.getSessionData(AuthProcessDataWrapper.class).getGenericDataFromSession(Constants.DATA_RESULT_MATCHING_BPK);
+    Assert.assertEquals("Wrong bpk", bPk, bpkRegister);
   }
 
-  @Test
-  @DirtiesContext
   /**
    * Multiple matches found in ZMR and ErnP with detail search
    */
+  @Test
+  @DirtiesContext
   public void testNode103_UserIdentified_DE() throws Exception {
     String givenName = randomGivenName;
     String familyName = randomFamilyName;
@@ -339,22 +328,18 @@ public class InitialSearchTaskFirstTest {
     handlers.add(de);
     task = new InitialSearchTask(handlers, ernpClient, zmrClient);
 
-    try {
-      task.execute(pendingReq1, executionContext);
+    task.execute(pendingReq1, executionContext);
 
-      String bPk = (String)
-          pendingReq1.getSessionData(AuthProcessDataWrapper.class).getGenericDataFromSession(Constants.DATA_RESULT_MATCHING_BPK);
-      Assert.assertTrue("Wrong bpk", bPk.equals(bpk));
-    } catch (final TaskExecutionException e) {
-      Assert.assertTrue("Wrong workflow, should not reach this point", false);
-    }
+    String bPk = (String)
+        pendingReq1.getSessionData(AuthProcessDataWrapper.class).getGenericDataFromSession(Constants.DATA_RESULT_MATCHING_BPK);
+    Assert.assertEquals("Wrong bpk", bPk, bpk);
   }
 
-  @Test
-  @DirtiesContext
   /**
    * Multiple matches found in ZMR and ErnP with detail search
    */
+  @Test
+  @DirtiesContext
   public void testNode104_ManualFixNecessary_DE() throws Exception {
     String givenName = randomGivenName;
     String familyName = randomFamilyName;
@@ -393,20 +378,20 @@ public class InitialSearchTaskFirstTest {
 
     try {
       task.execute(pendingReq1, executionContext);
-      Assert.assertTrue("Wrong workflow, should not reach this point/ get a bpk", false);
+      Assert.fail("Wrong workflow, should not reach this point/ get a bpk");
     } catch (final TaskExecutionException e) {
       Throwable origE = e.getOriginalException();
       Assert.assertTrue("Wrong exception", (origE.getCause() instanceof ManualFixNecessaryException));
     }
   }
 
-  @Test
-  @DirtiesContext
   /**
    * Multiple matches found in ZMR and ErnP with detail search
    */
+  @Test
+  @DirtiesContext
   public void testNode104_ManualFixNecessary_IT() throws Exception {
-    String fakeTaxNumber = RandomStringUtils.randomNumeric(14);;
+    String fakeTaxNumber = RandomStringUtils.randomNumeric(14);
     final AuthenticationResponse response = buildDummyAuthResponseRandomPersonIT_Tax(fakeTaxNumber);
     TestRequestImpl pendingReq1 = new TestRequestImpl();
     pendingReq1.getSessionData(AuthProcessDataWrapper.class)
@@ -432,20 +417,18 @@ public class InitialSearchTaskFirstTest {
     handlers.add(it);
     task = new InitialSearchTask(handlers, ernpClient, zmrClient);
 
-    try {
-      task.execute(pendingReq1, executionContext);
-      Assert.assertTrue("Wrong workflow, should not reach this point/ get a bpk", false);
-    } catch (final TaskExecutionException e) {
-      Throwable origE = e.getOriginalException();
-      Assert.assertTrue("Wrong exception", (origE.getCause() instanceof ManualFixNecessaryException));
-    }
+
+    TaskExecutionException exception = assertThrows(TaskExecutionException.class,
+            () -> task.execute(pendingReq1, executionContext));
+    Throwable origE = exception.getOriginalException();
+    Assert.assertTrue("Wrong exception", (origE.getCause() instanceof ManualFixNecessaryException));
   }
 
-  @Test
-  @DirtiesContext
   /**
    * NO match found in ZMR and ErnP with Initial search
    */
+  @Test
+  @DirtiesContext
   public void testNode105_TemporaryEnd() throws TaskExecutionException {
     ArrayList<RegisterResult> zmrResult = new ArrayList<>();
     Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(zmrResult);
@@ -509,17 +492,17 @@ public class InitialSearchTaskFirstTest {
         "afaf").attributes(attributeMap).build();
   }
 
-  private AttributeDefinition generateStringAttribute(String friendlyName, String fragment, String prefix) throws URISyntaxException {
+  private AttributeDefinition<Object> generateStringAttribute(String friendlyName, String fragment, String prefix) throws URISyntaxException {
     return generateAttribute(friendlyName, fragment, prefix, "eu.eidas.auth.commons.attribute.impl" +
         ".LiteralStringAttributeValueMarshaller");
   }
 
-  private AttributeDefinition generateDateTimeAttribute(String friendlyName, String fragment, String prefix) throws URISyntaxException {
+  private AttributeDefinition<Object> generateDateTimeAttribute(String friendlyName, String fragment, String prefix) throws URISyntaxException {
     return generateAttribute(friendlyName, fragment, prefix, "eu.eidas.auth.commons.attribute.impl" +
         ".DateTimeAttributeValueMarshaller");
   }
 
-  private AttributeDefinition generateAttribute(String friendlyName, String fragment, String prefix,
+  private AttributeDefinition<Object> generateAttribute(String friendlyName, String fragment, String prefix,
                                                 String marshaller) throws URISyntaxException {
     return AttributeDefinition.builder()
         .friendlyName(friendlyName).nameUri(new URI("ad", "sd", fragment))
-- 
cgit v1.2.3


From fb99ff15185b4f3b10d4c72270787b04281494bf Mon Sep 17 00:00:00 2001
From: Christian Kollmann <christian.kollmann@a-sit.at>
Date: Tue, 12 Jan 2021 15:08:17 +0100
Subject: Use generic list types in parameters and return types

List instead of ArrayList allows for easier mocking and stubbing
---
 .../eidas/v2/dao/MergedRegisterSearchResult.java   |  8 ++--
 .../auth/eidas/v2/ernp/DummyErnpClient.java        | 26 +++++-----
 .../modules/auth/eidas/v2/ernp/IErnpClient.java    | 10 ++--
 .../handler/DeSpecificDetailSearchProcessor.java   | 13 ++---
 .../handler/ItSpecificDetailSearchProcessor.java   | 14 ++----
 .../auth/eidas/v2/tasks/InitialSearchTask.java     | 19 ++------
 .../modules/auth/eidas/v2/zmr/DummyZmrClient.java  | 26 +++++-----
 .../modules/auth/eidas/v2/zmr/IZmrClient.java      | 10 ++--
 .../v2/test/tasks/InitialSearchTaskFirstTest.java  | 55 +++++++---------------
 9 files changed, 70 insertions(+), 111 deletions(-)

diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/MergedRegisterSearchResult.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/MergedRegisterSearchResult.java
index 7703af2a..e147b8aa 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/MergedRegisterSearchResult.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/MergedRegisterSearchResult.java
@@ -26,15 +26,15 @@ package at.asitplus.eidas.specific.modules.auth.eidas.v2.dao;
 import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.WorkflowException;
 import lombok.Data;
 
-import java.util.ArrayList;
+import java.util.List;
 
 @Data
 public class MergedRegisterSearchResult {
 
-  final ArrayList<RegisterResult> resultsZmr;
-  final ArrayList<RegisterResult> resultsErnp;
+  final List<RegisterResult> resultsZmr;
+  final List<RegisterResult> resultsErnp;
 
-  public MergedRegisterSearchResult(ArrayList<RegisterResult> resultsZmr, ArrayList<RegisterResult> resultsErnp) {
+  public MergedRegisterSearchResult(List<RegisterResult> resultsZmr, List<RegisterResult> resultsErnp) {
     this.resultsZmr = resultsZmr;
     this.resultsErnp = resultsErnp;
   }
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/ernp/DummyErnpClient.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/ernp/DummyErnpClient.java
index 3b49ab95..e514c808 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/ernp/DummyErnpClient.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/ernp/DummyErnpClient.java
@@ -27,30 +27,34 @@ import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.RegisterResult;
 import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.SimpleEidasData;
 import org.springframework.stereotype.Service;
 
-import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
 
 @Service("ErnbClientForeIDAS")
 public class DummyErnpClient implements IErnpClient {
 
   @Override
-  public ArrayList<RegisterResult> searchWithPersonIdentifier(String personIdentifier) {
-    return resultEmpty();
+  public List<RegisterResult> searchWithPersonIdentifier(String personIdentifier) {
+    return Collections.emptyList();
   }
 
   @Override
-  public ArrayList<RegisterResult> searchWithMds(String givenName, String familyName, String dateOfBirth) {
-    return resultEmpty();//TODO will I only receive matches where all three values match perfectly?
+  public List<RegisterResult> searchWithMds(String givenName, String familyName, String dateOfBirth) {
+    //TODO will I only receive matches where all three values match perfectly?
+    return Collections.emptyList();
   }
 
   @Override
-  public ArrayList<RegisterResult> searchDeSpecific(String givenName, String familyName, String dateOfBirth,
+  public List<RegisterResult> searchDeSpecific(String givenName, String familyName, String dateOfBirth,
                                                     String birthPlace, String birthName) {
-    return resultEmpty();//TODO
+    //TODO
+    return Collections.emptyList();
   }
 
   @Override
-  public ArrayList<RegisterResult> searchItSpecific(String taxNumber) {
-    return resultEmpty();//TODO
+  public List<RegisterResult> searchItSpecific(String taxNumber) {
+    //TODO
+    return Collections.emptyList();
   }
 
   @Override
@@ -58,9 +62,5 @@ public class DummyErnpClient implements IErnpClient {
     //TODO
   }
 
-  private ArrayList<RegisterResult> resultEmpty() {
-    return new ArrayList<RegisterResult>();//Nobody found
-  }
-
 
 }
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/ernp/IErnpClient.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/ernp/IErnpClient.java
index 01ac88fb..b9641c5c 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/ernp/IErnpClient.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/ernp/IErnpClient.java
@@ -26,18 +26,18 @@ package at.asitplus.eidas.specific.modules.auth.eidas.v2.ernp;
 import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.RegisterResult;
 import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.SimpleEidasData;
 
-import java.util.ArrayList;
+import java.util.List;
 
 public interface IErnpClient {
 
-  ArrayList<RegisterResult> searchWithPersonIdentifier(String personIdentifier);
+  List<RegisterResult> searchWithPersonIdentifier(String personIdentifier);
 
-  ArrayList<RegisterResult> searchWithMds(String givenName, String familyName, String dateOfBirth);
+  List<RegisterResult> searchWithMds(String givenName, String familyName, String dateOfBirth);
 
-  ArrayList<RegisterResult> searchDeSpecific(String givenName, String familyName, String dateOfBirth,
+  List<RegisterResult> searchDeSpecific(String givenName, String familyName, String dateOfBirth,
                                              String birthPlace, String birthName);
 
-  ArrayList<RegisterResult> searchItSpecific(String taxNumber);
+  List<RegisterResult> searchItSpecific(String taxNumber);
 
   void update(RegisterResult registerResult, SimpleEidasData eidData);
 }
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/DeSpecificDetailSearchProcessor.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/DeSpecificDetailSearchProcessor.java
index a29725c8..544d5b0c 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/DeSpecificDetailSearchProcessor.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/DeSpecificDetailSearchProcessor.java
@@ -30,7 +30,7 @@ import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.SimpleEidasData;
 import at.asitplus.eidas.specific.modules.auth.eidas.v2.ernp.IErnpClient;
 import at.asitplus.eidas.specific.modules.auth.eidas.v2.zmr.IZmrClient;
 
-import java.util.ArrayList;
+import java.util.List;
 
 public class DeSpecificDetailSearchProcessor extends CountrySpecificDetailSearchProcessor {
 
@@ -54,17 +54,12 @@ public class DeSpecificDetailSearchProcessor extends CountrySpecificDetailSearch
 
   @Override
   public MergedRegisterSearchResult search(SimpleEidasData eidData) {
-
-
-    ArrayList<RegisterResult> resultsZmr =
+    List<RegisterResult> resultsZmr =
         zmrClient.searchDeSpecific(eidData.getGivenName(), eidData.getFamilyName(), eidData.getDateOfBirth(),
             eidData.getPlaceOfBirth(), eidData.getBirthName());
-
-    ArrayList<RegisterResult> resultsErnb =
+    List<RegisterResult> resultsErnb =
         ernbClient.searchDeSpecific(eidData.getGivenName(), eidData.getFamilyName(), eidData.getDateOfBirth(),
             eidData.getPlaceOfBirth(), eidData.getBirthName());
-
-    MergedRegisterSearchResult searchResult = new MergedRegisterSearchResult(resultsZmr, resultsErnb);
-    return searchResult;
+    return new MergedRegisterSearchResult(resultsZmr, resultsErnb);
   }
 }
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/ItSpecificDetailSearchProcessor.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/ItSpecificDetailSearchProcessor.java
index e730066d..370a111c 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/ItSpecificDetailSearchProcessor.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/ItSpecificDetailSearchProcessor.java
@@ -30,7 +30,7 @@ import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.SimpleEidasData;
 import at.asitplus.eidas.specific.modules.auth.eidas.v2.ernp.IErnpClient;
 import at.asitplus.eidas.specific.modules.auth.eidas.v2.zmr.IZmrClient;
 
-import java.util.ArrayList;
+import java.util.List;
 
 public class ItSpecificDetailSearchProcessor extends CountrySpecificDetailSearchProcessor {
 
@@ -51,14 +51,8 @@ public class ItSpecificDetailSearchProcessor extends CountrySpecificDetailSearch
 
   @Override
   public MergedRegisterSearchResult search(SimpleEidasData eidData) {
-
-    ArrayList<RegisterResult> resultsZmr =
-        zmrClient.searchItSpecific(eidData.getTaxNumber());
-
-    ArrayList<RegisterResult> resultsErnb =
-        ernbClient.searchItSpecific(eidData.getTaxNumber());
-
-    MergedRegisterSearchResult searchResult = new MergedRegisterSearchResult(resultsZmr, resultsErnb);
-    return searchResult;
+    List<RegisterResult> resultsZmr = zmrClient.searchItSpecific(eidData.getTaxNumber());
+    List<RegisterResult> resultsErnb = ernbClient.searchItSpecific(eidData.getTaxNumber());
+    return new MergedRegisterSearchResult(resultsZmr, resultsErnb);
   }
 }
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/InitialSearchTask.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/InitialSearchTask.java
index ba05ef0d..fd9e93e0 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/InitialSearchTask.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/InitialSearchTask.java
@@ -52,7 +52,6 @@ import org.springframework.stereotype.Component;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -205,12 +204,10 @@ public class InitialSearchTask extends AbstractAuthServletTask {
   private String step8RegisterSearchWithMds(MergedRegisterSearchResult initialSearchResult,
                                             SimpleEidasData eidData) {
     log.trace("Starting step8RegisterSearchWithMds");
-    ArrayList<RegisterResult> resultsZmr =
+    List<RegisterResult> resultsZmr =
         zmrClient.searchWithMds(eidData.getGivenName(), eidData.getFamilyName(), eidData.getDateOfBirth());
-
-    ArrayList<RegisterResult> resultsErnp =
+    List<RegisterResult> resultsErnp =
         ernpClient.searchWithMds(eidData.getGivenName(), eidData.getFamilyName(), eidData.getDateOfBirth());
-
     MergedRegisterSearchResult mdsSearchResult = new MergedRegisterSearchResult(resultsZmr, resultsErnp);
     log.debug("Automerge " + initialSearchResult + " with " + eidData + " " + mdsSearchResult);
     //TODO implement next phase and return correct value
@@ -218,15 +215,9 @@ public class InitialSearchTask extends AbstractAuthServletTask {
   }
 
   private MergedRegisterSearchResult searchInZmrAndErnp(String personIdentifier) {
-
-    ArrayList<RegisterResult> resultsZmr =
-        zmrClient.searchWithPersonIdentifier(personIdentifier);
-
-    ArrayList<RegisterResult> resultsErnp =
-        ernpClient.searchWithPersonIdentifier(personIdentifier);
-
-    MergedRegisterSearchResult initialSearchResult = new MergedRegisterSearchResult(resultsZmr, resultsErnp);
-    return initialSearchResult;
+    List<RegisterResult> resultsZmr = zmrClient.searchWithPersonIdentifier(personIdentifier);
+    List<RegisterResult> resultsErnp = ernpClient.searchWithPersonIdentifier(personIdentifier);
+    return new MergedRegisterSearchResult(resultsZmr, resultsErnp);
   }
 
   private SimpleEidasData convertSimpleMapToSimpleData(Map<String, Object> eidasAttrMap)
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/zmr/DummyZmrClient.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/zmr/DummyZmrClient.java
index 60dd2ef2..b12c1bcb 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/zmr/DummyZmrClient.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/zmr/DummyZmrClient.java
@@ -27,30 +27,34 @@ import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.RegisterResult;
 import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.SimpleEidasData;
 import org.springframework.stereotype.Service;
 
-import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
 
 @Service("ZmrClientForeIDAS")
 public class DummyZmrClient implements IZmrClient {
 
   @Override
-  public ArrayList<RegisterResult> searchWithPersonIdentifier(String personIdentifier) {
-    return resultEmpty();
+  public List<RegisterResult> searchWithPersonIdentifier(String personIdentifier) {
+    return Collections.emptyList();
   }
 
   @Override
-  public ArrayList<RegisterResult> searchWithMds(String givenName, String familyName, String dateOfBirth) {
-    return resultEmpty();//TODO will I only receive matches where all three values match perfectly?
+  public List<RegisterResult> searchWithMds(String givenName, String familyName, String dateOfBirth) {
+    //TODO will I only receive matches where all three values match perfectly?
+    return Collections.emptyList();
   }
 
   @Override
-  public ArrayList<RegisterResult> searchDeSpecific(String givenName, String familyName, String dateOfBirth,
+  public List<RegisterResult> searchDeSpecific(String givenName, String familyName, String dateOfBirth,
                                                     String birthPlace, String birthName) {
-    return resultEmpty();//TODO
+    //TODO
+    return Collections.emptyList();
   }
 
   @Override
-  public ArrayList<RegisterResult> searchItSpecific(String taxNumber) {
-    return resultEmpty();//TODO
+  public List<RegisterResult> searchItSpecific(String taxNumber) {
+    //TODO
+    return Collections.emptyList();
   }
 
   @Override
@@ -58,8 +62,4 @@ public class DummyZmrClient implements IZmrClient {
     //TODO
   }
 
-  private ArrayList<RegisterResult> resultEmpty() {
-    return new ArrayList<RegisterResult>();//Nobody found
-  }
-
 }
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/zmr/IZmrClient.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/zmr/IZmrClient.java
index 3a518e64..5175cd7b 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/zmr/IZmrClient.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/zmr/IZmrClient.java
@@ -26,18 +26,18 @@ package at.asitplus.eidas.specific.modules.auth.eidas.v2.zmr;
 import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.RegisterResult;
 import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.SimpleEidasData;
 
-import java.util.ArrayList;
+import java.util.List;
 
 public interface IZmrClient {
 
-  ArrayList<RegisterResult> searchWithPersonIdentifier(String personIdentifier);
+  List<RegisterResult> searchWithPersonIdentifier(String personIdentifier);
 
-  ArrayList<RegisterResult> searchWithMds(String givenName, String familyName, String dateOfBirth);
+  List<RegisterResult> searchWithMds(String givenName, String familyName, String dateOfBirth);
 
-  ArrayList<RegisterResult> searchDeSpecific(String givenName, String familyName, String dateOfBirth,
+  List<RegisterResult> searchDeSpecific(String givenName, String familyName, String dateOfBirth,
                                              String birthPlace, String birthName);
 
-  ArrayList<RegisterResult> searchItSpecific(String taxNumber);
+  List<RegisterResult> searchItSpecific(String taxNumber);
 
   void update(RegisterResult registerResult, SimpleEidasData eidData);
 }
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskFirstTest.java b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskFirstTest.java
index 35e2e56e..1f512354 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskFirstTest.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskFirstTest.java
@@ -67,6 +67,7 @@ import java.io.IOException;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 import java.util.Random;
 
@@ -136,9 +137,7 @@ public class InitialSearchTaskFirstTest {
     String newFirstName = RandomStringUtils.randomAlphabetic(5);
     zmrResult.add(new RegisterResult(randomBpk, DE_ST+randomIdentifier, newFirstName, randomFamilyName, randomDate));
     Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(zmrResult);
-
-    ArrayList<RegisterResult> ernpResult = new ArrayList<>();
-    Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(ernpResult);
+    Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
 
     task.execute(pendingReq, executionContext);
     String bPk = (String)
@@ -152,9 +151,7 @@ public class InitialSearchTaskFirstTest {
   @Test
   @DirtiesContext
   public void testNode100_UserIdentifiedUpdateNecessary_b() throws TaskExecutionException {
-    ArrayList<RegisterResult> zmrResult = new ArrayList<>();
-    Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(zmrResult);
-
+    Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
     ArrayList<RegisterResult> ernpResult = new ArrayList<>();
     String randomBpk = RandomStringUtils.randomNumeric(6);
     ernpResult.add(new RegisterResult(randomBpk, DE_ST+randomIdentifier, "Max_new", randomFamilyName, randomDate));
@@ -177,9 +174,7 @@ public class InitialSearchTaskFirstTest {
     zmrResult.add(new RegisterResult("bpkMax", DE_ST+randomIdentifier, randomGivenName, randomFamilyName, randomDate));
     zmrResult.add(new RegisterResult("bpkMax", DE_ST+randomIdentifier, "Maximilian", randomFamilyName, randomDate));
     Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(zmrResult);
-
-    ArrayList<RegisterResult> ernpResult = new ArrayList<>();
-    Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(ernpResult);
+    Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
 
     TaskExecutionException exception = assertThrows(TaskExecutionException.class,
             () -> task.execute(pendingReq, executionContext));
@@ -195,9 +190,7 @@ public class InitialSearchTaskFirstTest {
   @DirtiesContext
   public void testNode101_ManualFixNecessary_b() {
     String randombpk = RandomStringUtils.random(5);
-    ArrayList<RegisterResult> zmrResult = new ArrayList<>();
-    Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(zmrResult);
-
+    Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
     ArrayList<RegisterResult> ernpResult = new ArrayList<>();
     ernpResult.add(new RegisterResult(randombpk, DE_ST+randomIdentifier, randomGivenName, randomFamilyName, randomDate));
     ernpResult.add(new RegisterResult(randombpk, DE_ST+randomIdentifier, randomGivenName+RandomStringUtils.random(2),
@@ -218,8 +211,7 @@ public class InitialSearchTaskFirstTest {
   @DirtiesContext
   public void testNode102_UserIdentified_a() throws Exception {
     String randomBpk = RandomStringUtils.randomNumeric(12);
-    ArrayList<RegisterResult> zmrResult = new ArrayList<>();
-    Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(zmrResult);
+    Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
 
     ArrayList<RegisterResult> ernpResult = new ArrayList<>();
     ernpResult.add(new RegisterResult(randomBpk, DE_ST+randomIdentifier, randomGivenName, randomFamilyName, randomDate));
@@ -242,9 +234,7 @@ public class InitialSearchTaskFirstTest {
     ArrayList<RegisterResult> zmrResult = new ArrayList<>();
     zmrResult.add(new RegisterResult(randomBpk, DE_ST+randomIdentifier, randomGivenName, randomFamilyName, randomDate));
     Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(zmrResult);
-
-    ArrayList<RegisterResult> ernpResult = new ArrayList<>();
-    Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(ernpResult);
+    Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
 
     task.execute(pendingReq, executionContext);
     String bPk = (String)
@@ -265,8 +255,7 @@ public class InitialSearchTaskFirstTest {
     pendingReq1.getSessionData(AuthProcessDataWrapper.class)
         .setGenericDataToSession(Constants.DATA_FULL_EIDAS_RESPONSE, response);
 
-    ArrayList<RegisterResult> zmrResultInitial = new ArrayList<>();
-    Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(zmrResultInitial);
+    Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
     ArrayList<RegisterResult> zmrResultSpecific = new ArrayList<>();
 
     zmrResultSpecific.add(new RegisterResult(bpkRegister, IT_ST+randomIdentifier+RandomStringUtils.random(2),
@@ -276,8 +265,7 @@ public class InitialSearchTaskFirstTest {
 
     Mockito.when(zmrClient.searchItSpecific(taxNumber)).thenReturn(zmrResultSpecific);
 
-    ArrayList<RegisterResult> ernpResultInitial = new ArrayList<>();
-    Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(ernpResultInitial);
+    Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
 
     List<CountrySpecificDetailSearchProcessor> handlers = new ArrayList<>();
     ItSpecificDetailSearchProcessor it = new ItSpecificDetailSearchProcessor(ernpClient, zmrClient);
@@ -310,8 +298,7 @@ public class InitialSearchTaskFirstTest {
     pendingReq1.getSessionData(AuthProcessDataWrapper.class)
         .setGenericDataToSession(Constants.DATA_FULL_EIDAS_RESPONSE, response);
 
-    ArrayList<RegisterResult> zmrResultInitial = new ArrayList<>();
-    Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(zmrResultInitial);
+    Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
     ArrayList<RegisterResult> zmrResultSpecific = new ArrayList<>();
 
     zmrResultSpecific.add(new RegisterResult(bpk, pseudonym, givenName, familyName, dateOfBirth, placeOfBirth,
@@ -320,8 +307,7 @@ public class InitialSearchTaskFirstTest {
 
     Mockito.when(zmrClient.searchDeSpecific(givenName, familyName, dateOfBirth, placeOfBirth, birthName)).thenReturn(zmrResultSpecific);
 
-    ArrayList<RegisterResult> ernpResultInitial = new ArrayList<>();
-    Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(ernpResultInitial);
+    Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
 
     List<CountrySpecificDetailSearchProcessor> handlers = new ArrayList<>();
     DeSpecificDetailSearchProcessor de = new DeSpecificDetailSearchProcessor(ernpClient, zmrClient);
@@ -356,8 +342,7 @@ public class InitialSearchTaskFirstTest {
     pendingReq1.getSessionData(AuthProcessDataWrapper.class)
         .setGenericDataToSession(Constants.DATA_FULL_EIDAS_RESPONSE, response);
 
-    ArrayList<RegisterResult> zmrResultInitial = new ArrayList<>();
-    Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(zmrResultInitial);
+    Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
     ArrayList<RegisterResult> zmrResultSpecific = new ArrayList<>();
 
     zmrResultSpecific.add(new RegisterResult(bpk1, pseudonym1, givenName, familyName, dateOfBirth, placeOfBirth,
@@ -368,8 +353,7 @@ public class InitialSearchTaskFirstTest {
         null, null));
     Mockito.when(zmrClient.searchDeSpecific(givenName, familyName, dateOfBirth, placeOfBirth, birthName)).thenReturn(zmrResultSpecific);
 
-    ArrayList<RegisterResult> ernpResultInitial = new ArrayList<>();
-    Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(ernpResultInitial);
+    Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
 
     List<CountrySpecificDetailSearchProcessor> handlers = new ArrayList<>();
     DeSpecificDetailSearchProcessor de = new DeSpecificDetailSearchProcessor(ernpClient, zmrClient);
@@ -397,8 +381,7 @@ public class InitialSearchTaskFirstTest {
     pendingReq1.getSessionData(AuthProcessDataWrapper.class)
         .setGenericDataToSession(Constants.DATA_FULL_EIDAS_RESPONSE, response);
 
-    ArrayList<RegisterResult> zmrResultInitial = new ArrayList<>();
-    Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(zmrResultInitial);
+    Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
     ArrayList<RegisterResult> zmrResultSpecific = new ArrayList<>();
 
     zmrResultSpecific.add(new RegisterResult("bpkMax", IT_ST+randomIdentifier+"4", randomGivenName, randomFamilyName,
@@ -409,8 +392,7 @@ public class InitialSearchTaskFirstTest {
         fakeTaxNumber, null));
     Mockito.when(zmrClient.searchItSpecific(fakeTaxNumber)).thenReturn(zmrResultSpecific);
 
-    ArrayList<RegisterResult> ernpResultInitial = new ArrayList<>();
-    Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(ernpResultInitial);
+    Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
 
     List<CountrySpecificDetailSearchProcessor> handlers = new ArrayList<>();
     ItSpecificDetailSearchProcessor it = new ItSpecificDetailSearchProcessor(ernpClient, zmrClient);
@@ -430,11 +412,8 @@ public class InitialSearchTaskFirstTest {
   @Test
   @DirtiesContext
   public void testNode105_TemporaryEnd() throws TaskExecutionException {
-    ArrayList<RegisterResult> zmrResult = new ArrayList<>();
-    Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(zmrResult);
-
-    ArrayList<RegisterResult> ernpResult = new ArrayList<>();
-    Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(ernpResult);
+    Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
+    Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
 
     task.execute(pendingReq, executionContext);
     String bPk = (String)
-- 
cgit v1.2.3


From 130df15476c455adb1a232fc555917ff69f0f09b Mon Sep 17 00:00:00 2001
From: Christian Kollmann <christian.kollmann@a-sit.at>
Date: Tue, 12 Jan 2021 15:13:47 +0100
Subject: Use random values in tests

---
 .../v2/test/tasks/InitialSearchTaskFirstTest.java  | 111 +++++++++------------
 1 file changed, 47 insertions(+), 64 deletions(-)

diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskFirstTest.java b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskFirstTest.java
index 1f512354..c18dabb9 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskFirstTest.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskFirstTest.java
@@ -87,10 +87,10 @@ public class InitialSearchTaskFirstTest {
   final ExecutionContext executionContext = new ExecutionContextImpl();
   private TestRequestImpl pendingReq;
   private final String randomIdentifier = RandomStringUtils.randomNumeric(10);
-  private final String randomFamilyName = RandomStringUtils.randomNumeric(11);
-  private final String randomGivenName = RandomStringUtils.randomNumeric(12);
-  private final String randomPlaceOfBirth = RandomStringUtils.randomNumeric(12);
-  private final String randomBirthName = RandomStringUtils.randomNumeric(12);
+  private final String randomFamilyName = RandomStringUtils.randomAlphabetic(10);
+  private final String randomGivenName = RandomStringUtils.randomAlphabetic(10);
+  private final String randomPlaceOfBirth = RandomStringUtils.randomAlphabetic(10);
+  private final String randomBirthName = RandomStringUtils.randomAlphabetic(10);
   private final String randomDate = "2011-01-"+ (10 + new Random().nextInt(18));
   private final String DE_ST = "de/st/";
   private final String IT_ST = "it/st/";
@@ -154,7 +154,8 @@ public class InitialSearchTaskFirstTest {
     Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
     ArrayList<RegisterResult> ernpResult = new ArrayList<>();
     String randomBpk = RandomStringUtils.randomNumeric(6);
-    ernpResult.add(new RegisterResult(randomBpk, DE_ST+randomIdentifier, "Max_new", randomFamilyName, randomDate));
+    String newRandomGivenName = RandomStringUtils.randomAlphabetic(10);
+    ernpResult.add(new RegisterResult(randomBpk, DE_ST+randomIdentifier, newRandomGivenName, randomFamilyName, randomDate));
     Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(ernpResult);
 
     task.execute(pendingReq, executionContext);
@@ -172,7 +173,8 @@ public class InitialSearchTaskFirstTest {
   public void testNode101_ManualFixNecessary_a() {
     ArrayList<RegisterResult> zmrResult = new ArrayList<>();
     zmrResult.add(new RegisterResult("bpkMax", DE_ST+randomIdentifier, randomGivenName, randomFamilyName, randomDate));
-    zmrResult.add(new RegisterResult("bpkMax", DE_ST+randomIdentifier, "Maximilian", randomFamilyName, randomDate));
+    String newRandomGivenName = randomGivenName + RandomStringUtils.randomAlphabetic(2);
+    zmrResult.add(new RegisterResult("bpkMax", DE_ST+randomIdentifier, newRandomGivenName, randomFamilyName, randomDate));
     Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(zmrResult);
     Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
 
@@ -189,13 +191,12 @@ public class InitialSearchTaskFirstTest {
   @Test
   @DirtiesContext
   public void testNode101_ManualFixNecessary_b() {
-    String randombpk = RandomStringUtils.random(5);
+    String randombpk = RandomStringUtils.randomNumeric(5);
     Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
     ArrayList<RegisterResult> ernpResult = new ArrayList<>();
     ernpResult.add(new RegisterResult(randombpk, DE_ST+randomIdentifier, randomGivenName, randomFamilyName, randomDate));
-    ernpResult.add(new RegisterResult(randombpk, DE_ST+randomIdentifier, randomGivenName+RandomStringUtils.random(2),
-        randomFamilyName,
-        randomDate));
+    String newRandomGivenName = randomGivenName + RandomStringUtils.randomAlphabetic(2);
+    ernpResult.add(new RegisterResult(randombpk, DE_ST+randomIdentifier, newRandomGivenName, randomFamilyName, randomDate));
     Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(ernpResult);
 
     TaskExecutionException exception = assertThrows(TaskExecutionException.class,
@@ -258,10 +259,9 @@ public class InitialSearchTaskFirstTest {
     Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
     ArrayList<RegisterResult> zmrResultSpecific = new ArrayList<>();
 
-    zmrResultSpecific.add(new RegisterResult(bpkRegister, IT_ST+randomIdentifier+RandomStringUtils.random(2),
-        randomGivenName,
-        randomFamilyName,
-        randomDate, null, null, taxNumber, null));
+    String newRandomPseudonym = IT_ST + randomIdentifier + RandomStringUtils.randomNumeric(2);
+    zmrResultSpecific.add(new RegisterResult(bpkRegister, newRandomPseudonym, randomGivenName, randomFamilyName,
+            randomDate, null, null, taxNumber, null));
 
     Mockito.when(zmrClient.searchItSpecific(taxNumber)).thenReturn(zmrResultSpecific);
 
@@ -285,15 +285,10 @@ public class InitialSearchTaskFirstTest {
   @Test
   @DirtiesContext
   public void testNode103_UserIdentified_DE() throws Exception {
-    String givenName = randomGivenName;
-    String familyName = randomFamilyName;
-    String pseudonym = DE_ST + RandomStringUtils.random(5);
-    String bpk = RandomStringUtils.random(5);
-    String dateOfBirth = randomDate;
-    String placeOfBirth = randomPlaceOfBirth;
-    String birthName = randomBirthName;
-    final AuthenticationResponse response = buildDummyAuthResponseDE(givenName, familyName, pseudonym,
-        dateOfBirth, placeOfBirth, birthName);
+    String randomPseudonym = DE_ST + RandomStringUtils.randomNumeric(5);
+    String randomBpk = RandomStringUtils.randomNumeric(5);
+    final AuthenticationResponse response = buildDummyAuthResponseDE(randomGivenName, randomFamilyName, randomPseudonym,
+            randomDate, randomPlaceOfBirth, randomBirthName);
     TestRequestImpl pendingReq1 = new TestRequestImpl();
     pendingReq1.getSessionData(AuthProcessDataWrapper.class)
         .setGenericDataToSession(Constants.DATA_FULL_EIDAS_RESPONSE, response);
@@ -301,11 +296,11 @@ public class InitialSearchTaskFirstTest {
     Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
     ArrayList<RegisterResult> zmrResultSpecific = new ArrayList<>();
 
-    zmrResultSpecific.add(new RegisterResult(bpk, pseudonym, givenName, familyName, dateOfBirth, placeOfBirth,
-        birthName,
-        null, null));
+    zmrResultSpecific.add(new RegisterResult(randomBpk, randomPseudonym, randomGivenName, randomFamilyName, randomDate,
+            randomPlaceOfBirth, randomBirthName,null, null));
 
-    Mockito.when(zmrClient.searchDeSpecific(givenName, familyName, dateOfBirth, placeOfBirth, birthName)).thenReturn(zmrResultSpecific);
+    Mockito.when(zmrClient.searchDeSpecific(randomGivenName, randomFamilyName, randomDate, randomPlaceOfBirth,
+            randomBirthName)).thenReturn(zmrResultSpecific);
 
     Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
 
@@ -316,9 +311,9 @@ public class InitialSearchTaskFirstTest {
 
     task.execute(pendingReq1, executionContext);
 
-    String bPk = (String)
+    String resultBpk = (String)
         pendingReq1.getSessionData(AuthProcessDataWrapper.class).getGenericDataFromSession(Constants.DATA_RESULT_MATCHING_BPK);
-    Assert.assertEquals("Wrong bpk", bPk, bpk);
+    Assert.assertEquals("Wrong bpk", resultBpk, randomBpk);
   }
 
   /**
@@ -327,17 +322,12 @@ public class InitialSearchTaskFirstTest {
   @Test
   @DirtiesContext
   public void testNode104_ManualFixNecessary_DE() throws Exception {
-    String givenName = randomGivenName;
-    String familyName = randomFamilyName;
-    String pseudonym1 = DE_ST + RandomStringUtils.random(5);
-    String pseudonym2 = pseudonym1 + RandomStringUtils.random(2);
-    String bpk1 = RandomStringUtils.random(5);
-    String bpk2 = bpk1 + RandomStringUtils.random(2);
-    String dateOfBirth = randomDate;
-    String placeOfBirth = randomPlaceOfBirth;
-    String birthName = randomBirthName;
-    final AuthenticationResponse response = buildDummyAuthResponseDE(givenName, familyName, pseudonym1,
-        dateOfBirth, placeOfBirth, birthName);
+    String pseudonym1 = DE_ST + RandomStringUtils.randomNumeric(5);
+    String pseudonym2 = pseudonym1 + RandomStringUtils.randomNumeric(2);
+    String bpk1 = RandomStringUtils.randomNumeric(5);
+    String bpk2 = bpk1 + RandomStringUtils.randomNumeric(2);
+    final AuthenticationResponse response = buildDummyAuthResponseDE(randomGivenName, randomFamilyName, pseudonym1,
+            randomDate, randomPlaceOfBirth, randomBirthName);
     TestRequestImpl pendingReq1 = new TestRequestImpl();
     pendingReq1.getSessionData(AuthProcessDataWrapper.class)
         .setGenericDataToSession(Constants.DATA_FULL_EIDAS_RESPONSE, response);
@@ -345,13 +335,12 @@ public class InitialSearchTaskFirstTest {
     Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
     ArrayList<RegisterResult> zmrResultSpecific = new ArrayList<>();
 
-    zmrResultSpecific.add(new RegisterResult(bpk1, pseudonym1, givenName, familyName, dateOfBirth, placeOfBirth,
-        birthName,
-        null, null));
-    zmrResultSpecific.add(new RegisterResult(bpk2, pseudonym2, givenName, familyName, dateOfBirth, placeOfBirth,
-        birthName,
-        null, null));
-    Mockito.when(zmrClient.searchDeSpecific(givenName, familyName, dateOfBirth, placeOfBirth, birthName)).thenReturn(zmrResultSpecific);
+    zmrResultSpecific.add(new RegisterResult(bpk1, pseudonym1, randomGivenName, randomFamilyName, randomDate,
+            randomPlaceOfBirth, randomBirthName,null, null));
+    zmrResultSpecific.add(new RegisterResult(bpk2, pseudonym2, randomGivenName, randomFamilyName, randomDate,
+            randomPlaceOfBirth, randomBirthName,null, null));
+    Mockito.when(zmrClient.searchDeSpecific(randomGivenName, randomFamilyName, randomDate, randomPlaceOfBirth,
+            randomBirthName)).thenReturn(zmrResultSpecific);
 
     Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
 
@@ -360,13 +349,10 @@ public class InitialSearchTaskFirstTest {
     handlers.add(de);
     task = new InitialSearchTask(handlers, ernpClient, zmrClient);
 
-    try {
-      task.execute(pendingReq1, executionContext);
-      Assert.fail("Wrong workflow, should not reach this point/ get a bpk");
-    } catch (final TaskExecutionException e) {
-      Throwable origE = e.getOriginalException();
-      Assert.assertTrue("Wrong exception", (origE.getCause() instanceof ManualFixNecessaryException));
-    }
+    TaskExecutionException exception = assertThrows(TaskExecutionException.class,
+            () -> task.execute(pendingReq1, executionContext));
+    Throwable origE = exception.getOriginalException();
+    Assert.assertTrue("Wrong exception", (origE.getCause() instanceof ManualFixNecessaryException));
   }
 
   /**
@@ -384,12 +370,10 @@ public class InitialSearchTaskFirstTest {
     Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
     ArrayList<RegisterResult> zmrResultSpecific = new ArrayList<>();
 
-    zmrResultSpecific.add(new RegisterResult("bpkMax", IT_ST+randomIdentifier+"4", randomGivenName, randomFamilyName,
-        randomDate, null, null,
-        fakeTaxNumber, null));
-    zmrResultSpecific.add(new RegisterResult("bpkMax1", IT_ST+randomIdentifier+"5", randomGivenName, randomFamilyName,
-        randomDate, null, null,
-        fakeTaxNumber, null));
+    zmrResultSpecific.add(new RegisterResult("bpkMax", IT_ST+randomIdentifier+"4", randomGivenName,
+            randomFamilyName, randomDate, null, null, fakeTaxNumber, null));
+    zmrResultSpecific.add(new RegisterResult("bpkMax1", IT_ST+randomIdentifier+"5", randomGivenName,
+            randomFamilyName, randomDate, null, null, fakeTaxNumber, null));
     Mockito.when(zmrClient.searchItSpecific(fakeTaxNumber)).thenReturn(zmrResultSpecific);
 
     Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
@@ -424,13 +408,12 @@ public class InitialSearchTaskFirstTest {
 
   @NotNull
   private AuthenticationResponse buildDummyAuthResponseRandomPerson() throws URISyntaxException {
-    return buildDummyAuthResponse(randomGivenName, randomFamilyName,
-        DE_ST+randomIdentifier, randomDate);
+    return buildDummyAuthResponse(randomGivenName, randomFamilyName, DE_ST+randomIdentifier, randomDate);
   }
 
   private AuthenticationResponse buildDummyAuthResponseRandomPersonIT_Tax(String taxNumber) throws URISyntaxException {
-    return buildDummyAuthResponse(randomGivenName, randomFamilyName,
-        IT_ST+randomIdentifier, randomDate, taxNumber, null, null);
+    return buildDummyAuthResponse(randomGivenName, randomFamilyName, IT_ST+randomIdentifier, randomDate,
+            taxNumber, null, null);
   }
 
   @NotNull
-- 
cgit v1.2.3


From ccad318ae01794b246f5ca02c954fe94a92be515 Mon Sep 17 00:00:00 2001
From: Christian Kollmann <christian.kollmann@a-sit.at>
Date: Tue, 12 Jan 2021 15:25:51 +0100
Subject: Use clear Arrange-Act-Assert structure in tests

---
 .../v2/test/tasks/InitialSearchTaskFirstTest.java  | 88 ++++++++--------------
 1 file changed, 31 insertions(+), 57 deletions(-)

diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskFirstTest.java b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskFirstTest.java
index c18dabb9..99764aad 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskFirstTest.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskFirstTest.java
@@ -135,13 +135,15 @@ public class InitialSearchTaskFirstTest {
     ArrayList<RegisterResult> zmrResult = new ArrayList<>();
     String randomBpk = RandomStringUtils.randomNumeric(6);
     String newFirstName = RandomStringUtils.randomAlphabetic(5);
-    zmrResult.add(new RegisterResult(randomBpk, DE_ST+randomIdentifier, newFirstName, randomFamilyName, randomDate));
-    Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(zmrResult);
+    String randomPseudonym = DE_ST + randomIdentifier;
+    Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.singletonList(
+            new RegisterResult(randomBpk, randomPseudonym, newFirstName, randomFamilyName, randomDate)));
     Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
 
     task.execute(pendingReq, executionContext);
     String bPk = (String)
         pendingReq.getSessionData(AuthProcessDataWrapper.class).getGenericDataFromSession(Constants.DATA_RESULT_MATCHING_BPK);
+
     Assert.assertEquals("Wrong bpk", bPk, randomBpk);
   }
 
@@ -152,19 +154,18 @@ public class InitialSearchTaskFirstTest {
   @DirtiesContext
   public void testNode100_UserIdentifiedUpdateNecessary_b() throws TaskExecutionException {
     Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
-    ArrayList<RegisterResult> ernpResult = new ArrayList<>();
     String randomBpk = RandomStringUtils.randomNumeric(6);
     String newRandomGivenName = RandomStringUtils.randomAlphabetic(10);
-    ernpResult.add(new RegisterResult(randomBpk, DE_ST+randomIdentifier, newRandomGivenName, randomFamilyName, randomDate));
-    Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(ernpResult);
+    Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.singletonList(
+            new RegisterResult(randomBpk, DE_ST+randomIdentifier, newRandomGivenName, randomFamilyName, randomDate)));
 
     task.execute(pendingReq, executionContext);
     String bPk = (String)
         pendingReq.getSessionData(AuthProcessDataWrapper.class).getGenericDataFromSession(Constants.DATA_RESULT_MATCHING_BPK);
+
     Assert.assertEquals("Wrong bpk", bPk, randomBpk);
   }
 
-
   /**
    * Two matches found in ZMR
    */
@@ -180,6 +181,7 @@ public class InitialSearchTaskFirstTest {
 
     TaskExecutionException exception = assertThrows(TaskExecutionException.class,
             () -> task.execute(pendingReq, executionContext));
+
     Throwable origE = exception.getOriginalException();
     Assert.assertTrue("Wrong exception", (origE.getCause() instanceof ManualFixNecessaryException));
   }
@@ -201,6 +203,7 @@ public class InitialSearchTaskFirstTest {
 
     TaskExecutionException exception = assertThrows(TaskExecutionException.class,
             () -> task.execute(pendingReq, executionContext));
+
     Throwable origE = exception.getOriginalException();
     Assert.assertTrue("Wrong exception", (origE.getCause() instanceof ManualFixNecessaryException));
   }
@@ -213,10 +216,8 @@ public class InitialSearchTaskFirstTest {
   public void testNode102_UserIdentified_a() throws Exception {
     String randomBpk = RandomStringUtils.randomNumeric(12);
     Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
-
-    ArrayList<RegisterResult> ernpResult = new ArrayList<>();
-    ernpResult.add(new RegisterResult(randomBpk, DE_ST+randomIdentifier, randomGivenName, randomFamilyName, randomDate));
-    Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(ernpResult);
+    Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.singletonList(
+            new RegisterResult(randomBpk, DE_ST+randomIdentifier, randomGivenName, randomFamilyName, randomDate)));
 
     task.execute(pendingReq, executionContext);
     String bPk = (String)
@@ -231,13 +232,12 @@ public class InitialSearchTaskFirstTest {
   @DirtiesContext
   public void testNode102_UserIdentified_b() throws Exception {
     String randomBpk = RandomStringUtils.randomNumeric(14);
-
-    ArrayList<RegisterResult> zmrResult = new ArrayList<>();
-    zmrResult.add(new RegisterResult(randomBpk, DE_ST+randomIdentifier, randomGivenName, randomFamilyName, randomDate));
-    Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(zmrResult);
+    Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.singletonList(
+            new RegisterResult(randomBpk, DE_ST+randomIdentifier, randomGivenName, randomFamilyName, randomDate)));
     Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
 
     task.execute(pendingReq, executionContext);
+
     String bPk = (String)
         pendingReq.getSessionData(AuthProcessDataWrapper.class).getGenericDataFromSession(Constants.DATA_RESULT_MATCHING_BPK);
     Assert.assertEquals("Wrong bpk", bPk, randomBpk);
@@ -255,22 +255,14 @@ public class InitialSearchTaskFirstTest {
     TestRequestImpl pendingReq1 = new TestRequestImpl();
     pendingReq1.getSessionData(AuthProcessDataWrapper.class)
         .setGenericDataToSession(Constants.DATA_FULL_EIDAS_RESPONSE, response);
-
     Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
-    ArrayList<RegisterResult> zmrResultSpecific = new ArrayList<>();
-
     String newRandomPseudonym = IT_ST + randomIdentifier + RandomStringUtils.randomNumeric(2);
-    zmrResultSpecific.add(new RegisterResult(bpkRegister, newRandomPseudonym, randomGivenName, randomFamilyName,
-            randomDate, null, null, taxNumber, null));
-
-    Mockito.when(zmrClient.searchItSpecific(taxNumber)).thenReturn(zmrResultSpecific);
-
+    Mockito.when(zmrClient.searchItSpecific(taxNumber)).thenReturn(Collections.singletonList(
+            new RegisterResult(bpkRegister, newRandomPseudonym, randomGivenName, randomFamilyName,
+                    randomDate, null, null, taxNumber, null)));
     Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
-
-    List<CountrySpecificDetailSearchProcessor> handlers = new ArrayList<>();
-    ItSpecificDetailSearchProcessor it = new ItSpecificDetailSearchProcessor(ernpClient, zmrClient);
-    handlers.add(it);
-    task = new InitialSearchTask(handlers, ernpClient, zmrClient);
+    task = new InitialSearchTask(Collections.singletonList(new ItSpecificDetailSearchProcessor(ernpClient, zmrClient)),
+            ernpClient, zmrClient);
 
     task.execute(pendingReq1, executionContext);
 
@@ -292,22 +284,14 @@ public class InitialSearchTaskFirstTest {
     TestRequestImpl pendingReq1 = new TestRequestImpl();
     pendingReq1.getSessionData(AuthProcessDataWrapper.class)
         .setGenericDataToSession(Constants.DATA_FULL_EIDAS_RESPONSE, response);
-
     Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
-    ArrayList<RegisterResult> zmrResultSpecific = new ArrayList<>();
-
-    zmrResultSpecific.add(new RegisterResult(randomBpk, randomPseudonym, randomGivenName, randomFamilyName, randomDate,
-            randomPlaceOfBirth, randomBirthName,null, null));
-
     Mockito.when(zmrClient.searchDeSpecific(randomGivenName, randomFamilyName, randomDate, randomPlaceOfBirth,
-            randomBirthName)).thenReturn(zmrResultSpecific);
-
+            randomBirthName))
+            .thenReturn(Collections.singletonList(new RegisterResult(randomBpk, randomPseudonym, randomGivenName,
+                    randomFamilyName, randomDate, randomPlaceOfBirth, randomBirthName,null, null)));
     Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
-
-    List<CountrySpecificDetailSearchProcessor> handlers = new ArrayList<>();
-    DeSpecificDetailSearchProcessor de = new DeSpecificDetailSearchProcessor(ernpClient, zmrClient);
-    handlers.add(de);
-    task = new InitialSearchTask(handlers, ernpClient, zmrClient);
+    task = new InitialSearchTask(Collections.singletonList(new DeSpecificDetailSearchProcessor(ernpClient, zmrClient)),
+            ernpClient, zmrClient);
 
     task.execute(pendingReq1, executionContext);
 
@@ -331,26 +315,21 @@ public class InitialSearchTaskFirstTest {
     TestRequestImpl pendingReq1 = new TestRequestImpl();
     pendingReq1.getSessionData(AuthProcessDataWrapper.class)
         .setGenericDataToSession(Constants.DATA_FULL_EIDAS_RESPONSE, response);
-
     Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
     ArrayList<RegisterResult> zmrResultSpecific = new ArrayList<>();
-
     zmrResultSpecific.add(new RegisterResult(bpk1, pseudonym1, randomGivenName, randomFamilyName, randomDate,
             randomPlaceOfBirth, randomBirthName,null, null));
     zmrResultSpecific.add(new RegisterResult(bpk2, pseudonym2, randomGivenName, randomFamilyName, randomDate,
             randomPlaceOfBirth, randomBirthName,null, null));
     Mockito.when(zmrClient.searchDeSpecific(randomGivenName, randomFamilyName, randomDate, randomPlaceOfBirth,
             randomBirthName)).thenReturn(zmrResultSpecific);
-
     Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
-
-    List<CountrySpecificDetailSearchProcessor> handlers = new ArrayList<>();
-    DeSpecificDetailSearchProcessor de = new DeSpecificDetailSearchProcessor(ernpClient, zmrClient);
-    handlers.add(de);
-    task = new InitialSearchTask(handlers, ernpClient, zmrClient);
+    task = new InitialSearchTask(Collections.singletonList(new DeSpecificDetailSearchProcessor(ernpClient, zmrClient)),
+            ernpClient, zmrClient);
 
     TaskExecutionException exception = assertThrows(TaskExecutionException.class,
             () -> task.execute(pendingReq1, executionContext));
+
     Throwable origE = exception.getOriginalException();
     Assert.assertTrue("Wrong exception", (origE.getCause() instanceof ManualFixNecessaryException));
   }
@@ -366,26 +345,20 @@ public class InitialSearchTaskFirstTest {
     TestRequestImpl pendingReq1 = new TestRequestImpl();
     pendingReq1.getSessionData(AuthProcessDataWrapper.class)
         .setGenericDataToSession(Constants.DATA_FULL_EIDAS_RESPONSE, response);
-
     Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
     ArrayList<RegisterResult> zmrResultSpecific = new ArrayList<>();
-
     zmrResultSpecific.add(new RegisterResult("bpkMax", IT_ST+randomIdentifier+"4", randomGivenName,
             randomFamilyName, randomDate, null, null, fakeTaxNumber, null));
     zmrResultSpecific.add(new RegisterResult("bpkMax1", IT_ST+randomIdentifier+"5", randomGivenName,
             randomFamilyName, randomDate, null, null, fakeTaxNumber, null));
     Mockito.when(zmrClient.searchItSpecific(fakeTaxNumber)).thenReturn(zmrResultSpecific);
-
     Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
-
-    List<CountrySpecificDetailSearchProcessor> handlers = new ArrayList<>();
-    ItSpecificDetailSearchProcessor it = new ItSpecificDetailSearchProcessor(ernpClient, zmrClient);
-    handlers.add(it);
-    task = new InitialSearchTask(handlers, ernpClient, zmrClient);
-
+    task = new InitialSearchTask(Collections.singletonList(new ItSpecificDetailSearchProcessor(ernpClient, zmrClient)),
+            ernpClient, zmrClient);
 
     TaskExecutionException exception = assertThrows(TaskExecutionException.class,
             () -> task.execute(pendingReq1, executionContext));
+
     Throwable origE = exception.getOriginalException();
     Assert.assertTrue("Wrong exception", (origE.getCause() instanceof ManualFixNecessaryException));
   }
@@ -400,6 +373,7 @@ public class InitialSearchTaskFirstTest {
     Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
 
     task.execute(pendingReq, executionContext);
+
     String bPk = (String)
         pendingReq.getSessionData(AuthProcessDataWrapper.class).getGenericDataFromSession(Constants.DATA_RESULT_MATCHING_BPK);
     Assert.assertEquals("Wrong bpk", "TODO-Temporary-Endnode-105", bPk);
-- 
cgit v1.2.3


From 2e8313758ae4d55274319200aba9226e65f2a82c Mon Sep 17 00:00:00 2001
From: Christian Kollmann <christian.kollmann@a-sit.at>
Date: Tue, 12 Jan 2021 15:50:57 +0100
Subject: Rename variables in test for better readability

---
 .../v2/test/tasks/InitialSearchTaskFirstTest.java  | 177 +++++++++++----------
 1 file changed, 94 insertions(+), 83 deletions(-)

diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskFirstTest.java b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskFirstTest.java
index 99764aad..9f58ba71 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskFirstTest.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskFirstTest.java
@@ -28,7 +28,6 @@ import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.RegisterResult;
 import at.asitplus.eidas.specific.modules.auth.eidas.v2.ernp.IErnpClient;
 import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.ManualFixNecessaryException;
 import at.asitplus.eidas.specific.modules.auth.eidas.v2.handler.DeSpecificDetailSearchProcessor;
-import at.asitplus.eidas.specific.modules.auth.eidas.v2.handler.CountrySpecificDetailSearchProcessor;
 import at.asitplus.eidas.specific.modules.auth.eidas.v2.handler.ItSpecificDetailSearchProcessor;
 import at.asitplus.eidas.specific.modules.auth.eidas.v2.tasks.InitialSearchTask;
 import at.asitplus.eidas.specific.modules.auth.eidas.v2.zmr.IZmrClient;
@@ -68,7 +67,6 @@ import java.net.URI;
 import java.net.URISyntaxException;
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.List;
 import java.util.Random;
 
 import static org.junit.Assert.assertThrows;
@@ -78,6 +76,9 @@ import static org.junit.Assert.assertThrows;
 @DirtiesContext(classMode = ClassMode.BEFORE_CLASS)
 public class InitialSearchTaskFirstTest {
 
+  private static final String DE_ST = "de/st/";
+  private static final String IT_ST = "it/st/";
+
   private InitialSearchTask task;
   @Mock
   private IZmrClient zmrClient;
@@ -86,14 +87,14 @@ public class InitialSearchTaskFirstTest {
 
   final ExecutionContext executionContext = new ExecutionContextImpl();
   private TestRequestImpl pendingReq;
+  private final String randomBpk = RandomStringUtils.randomNumeric(6);
   private final String randomIdentifier = RandomStringUtils.randomNumeric(10);
+  private final String randomPseudonym = DE_ST + randomIdentifier;
   private final String randomFamilyName = RandomStringUtils.randomAlphabetic(10);
   private final String randomGivenName = RandomStringUtils.randomAlphabetic(10);
   private final String randomPlaceOfBirth = RandomStringUtils.randomAlphabetic(10);
   private final String randomBirthName = RandomStringUtils.randomAlphabetic(10);
-  private final String randomDate = "2011-01-"+ (10 + new Random().nextInt(18));
-  private final String DE_ST = "de/st/";
-  private final String IT_ST = "it/st/";
+  private final String randomDate = "2011-01-" + (10 + new Random().nextInt(18));
 
   /**
    * jUnit class initializer.
@@ -132,17 +133,15 @@ public class InitialSearchTaskFirstTest {
   @Test
   @DirtiesContext
   public void testNode100_UserIdentifiedUpdateNecessary_a() throws Exception {
-    ArrayList<RegisterResult> zmrResult = new ArrayList<>();
-    String randomBpk = RandomStringUtils.randomNumeric(6);
-    String newFirstName = RandomStringUtils.randomAlphabetic(5);
-    String randomPseudonym = DE_ST + randomIdentifier;
+    String newFirstName = RandomStringUtils.randomAlphabetic(10);
     Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.singletonList(
-            new RegisterResult(randomBpk, randomPseudonym, newFirstName, randomFamilyName, randomDate)));
+        new RegisterResult(randomBpk, randomPseudonym, newFirstName, randomFamilyName, randomDate)));
     Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
 
     task.execute(pendingReq, executionContext);
     String bPk = (String)
-        pendingReq.getSessionData(AuthProcessDataWrapper.class).getGenericDataFromSession(Constants.DATA_RESULT_MATCHING_BPK);
+        pendingReq.getSessionData(AuthProcessDataWrapper.class)
+            .getGenericDataFromSession(Constants.DATA_RESULT_MATCHING_BPK);
 
     Assert.assertEquals("Wrong bpk", bPk, randomBpk);
   }
@@ -154,14 +153,14 @@ public class InitialSearchTaskFirstTest {
   @DirtiesContext
   public void testNode100_UserIdentifiedUpdateNecessary_b() throws TaskExecutionException {
     Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
-    String randomBpk = RandomStringUtils.randomNumeric(6);
     String newRandomGivenName = RandomStringUtils.randomAlphabetic(10);
     Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.singletonList(
-            new RegisterResult(randomBpk, DE_ST+randomIdentifier, newRandomGivenName, randomFamilyName, randomDate)));
+        new RegisterResult(randomBpk, randomPseudonym, newRandomGivenName, randomFamilyName, randomDate)));
 
     task.execute(pendingReq, executionContext);
     String bPk = (String)
-        pendingReq.getSessionData(AuthProcessDataWrapper.class).getGenericDataFromSession(Constants.DATA_RESULT_MATCHING_BPK);
+        pendingReq.getSessionData(AuthProcessDataWrapper.class)
+            .getGenericDataFromSession(Constants.DATA_RESULT_MATCHING_BPK);
 
     Assert.assertEquals("Wrong bpk", bPk, randomBpk);
   }
@@ -173,14 +172,14 @@ public class InitialSearchTaskFirstTest {
   @DirtiesContext
   public void testNode101_ManualFixNecessary_a() {
     ArrayList<RegisterResult> zmrResult = new ArrayList<>();
-    zmrResult.add(new RegisterResult("bpkMax", DE_ST+randomIdentifier, randomGivenName, randomFamilyName, randomDate));
+    zmrResult.add(new RegisterResult(randomBpk, randomPseudonym, randomGivenName, randomFamilyName, randomDate));
     String newRandomGivenName = randomGivenName + RandomStringUtils.randomAlphabetic(2);
-    zmrResult.add(new RegisterResult("bpkMax", DE_ST+randomIdentifier, newRandomGivenName, randomFamilyName, randomDate));
+    zmrResult.add(new RegisterResult(randomBpk, randomPseudonym, newRandomGivenName, randomFamilyName, randomDate));
     Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(zmrResult);
     Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
 
     TaskExecutionException exception = assertThrows(TaskExecutionException.class,
-            () -> task.execute(pendingReq, executionContext));
+        () -> task.execute(pendingReq, executionContext));
 
     Throwable origE = exception.getOriginalException();
     Assert.assertTrue("Wrong exception", (origE.getCause() instanceof ManualFixNecessaryException));
@@ -193,16 +192,16 @@ public class InitialSearchTaskFirstTest {
   @Test
   @DirtiesContext
   public void testNode101_ManualFixNecessary_b() {
-    String randombpk = RandomStringUtils.randomNumeric(5);
     Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
     ArrayList<RegisterResult> ernpResult = new ArrayList<>();
-    ernpResult.add(new RegisterResult(randombpk, DE_ST+randomIdentifier, randomGivenName, randomFamilyName, randomDate));
+    ernpResult.add(new RegisterResult(randomBpk, randomPseudonym, randomGivenName, randomFamilyName, randomDate));
     String newRandomGivenName = randomGivenName + RandomStringUtils.randomAlphabetic(2);
-    ernpResult.add(new RegisterResult(randombpk, DE_ST+randomIdentifier, newRandomGivenName, randomFamilyName, randomDate));
+    ernpResult.add(
+        new RegisterResult(randomBpk, randomPseudonym, newRandomGivenName, randomFamilyName, randomDate));
     Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(ernpResult);
 
     TaskExecutionException exception = assertThrows(TaskExecutionException.class,
-            () -> task.execute(pendingReq, executionContext));
+        () -> task.execute(pendingReq, executionContext));
 
     Throwable origE = exception.getOriginalException();
     Assert.assertTrue("Wrong exception", (origE.getCause() instanceof ManualFixNecessaryException));
@@ -214,14 +213,14 @@ public class InitialSearchTaskFirstTest {
   @Test
   @DirtiesContext
   public void testNode102_UserIdentified_a() throws Exception {
-    String randomBpk = RandomStringUtils.randomNumeric(12);
     Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
     Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.singletonList(
-            new RegisterResult(randomBpk, DE_ST+randomIdentifier, randomGivenName, randomFamilyName, randomDate)));
+        new RegisterResult(randomBpk, randomPseudonym, randomGivenName, randomFamilyName, randomDate)));
 
     task.execute(pendingReq, executionContext);
     String bPk = (String)
-        pendingReq.getSessionData(AuthProcessDataWrapper.class).getGenericDataFromSession(Constants.DATA_RESULT_MATCHING_BPK);
+        pendingReq.getSessionData(AuthProcessDataWrapper.class)
+            .getGenericDataFromSession(Constants.DATA_RESULT_MATCHING_BPK);
     Assert.assertEquals("Wrong bpk", bPk, randomBpk);
   }
 
@@ -231,15 +230,15 @@ public class InitialSearchTaskFirstTest {
   @Test
   @DirtiesContext
   public void testNode102_UserIdentified_b() throws Exception {
-    String randomBpk = RandomStringUtils.randomNumeric(14);
     Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.singletonList(
-            new RegisterResult(randomBpk, DE_ST+randomIdentifier, randomGivenName, randomFamilyName, randomDate)));
+        new RegisterResult(randomBpk, randomPseudonym, randomGivenName, randomFamilyName, randomDate)));
     Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
 
     task.execute(pendingReq, executionContext);
 
     String bPk = (String)
-        pendingReq.getSessionData(AuthProcessDataWrapper.class).getGenericDataFromSession(Constants.DATA_RESULT_MATCHING_BPK);
+        pendingReq.getSessionData(AuthProcessDataWrapper.class)
+            .getGenericDataFromSession(Constants.DATA_RESULT_MATCHING_BPK);
     Assert.assertEquals("Wrong bpk", bPk, randomBpk);
   }
 
@@ -249,7 +248,6 @@ public class InitialSearchTaskFirstTest {
   @Test
   @DirtiesContext
   public void testNode103_UserIdentified_IT() throws Exception {
-    String bpkRegister = RandomStringUtils.randomNumeric(14);
     String taxNumber = RandomStringUtils.randomNumeric(14);
     final AuthenticationResponse response = buildDummyAuthResponseRandomPersonIT_Tax(taxNumber);
     TestRequestImpl pendingReq1 = new TestRequestImpl();
@@ -258,17 +256,19 @@ public class InitialSearchTaskFirstTest {
     Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
     String newRandomPseudonym = IT_ST + randomIdentifier + RandomStringUtils.randomNumeric(2);
     Mockito.when(zmrClient.searchItSpecific(taxNumber)).thenReturn(Collections.singletonList(
-            new RegisterResult(bpkRegister, newRandomPseudonym, randomGivenName, randomFamilyName,
-                    randomDate, null, null, taxNumber, null)));
+        new RegisterResult(randomBpk, newRandomPseudonym, randomGivenName, randomFamilyName,
+            randomDate, null, null, taxNumber, null)));
     Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
-    task = new InitialSearchTask(Collections.singletonList(new ItSpecificDetailSearchProcessor(ernpClient, zmrClient)),
-            ernpClient, zmrClient);
+    task = new InitialSearchTask(
+        Collections.singletonList(new ItSpecificDetailSearchProcessor(ernpClient, zmrClient)),
+        ernpClient, zmrClient);
 
     task.execute(pendingReq1, executionContext);
 
     String bPk = (String)
-        pendingReq1.getSessionData(AuthProcessDataWrapper.class).getGenericDataFromSession(Constants.DATA_RESULT_MATCHING_BPK);
-    Assert.assertEquals("Wrong bpk", bPk, bpkRegister);
+        pendingReq1.getSessionData(AuthProcessDataWrapper.class)
+            .getGenericDataFromSession(Constants.DATA_RESULT_MATCHING_BPK);
+    Assert.assertEquals("Wrong bpk", bPk, randomBpk);
   }
 
   /**
@@ -277,26 +277,27 @@ public class InitialSearchTaskFirstTest {
   @Test
   @DirtiesContext
   public void testNode103_UserIdentified_DE() throws Exception {
-    String randomPseudonym = DE_ST + RandomStringUtils.randomNumeric(5);
-    String randomBpk = RandomStringUtils.randomNumeric(5);
-    final AuthenticationResponse response = buildDummyAuthResponseDE(randomGivenName, randomFamilyName, randomPseudonym,
-            randomDate, randomPlaceOfBirth, randomBirthName);
+    final AuthenticationResponse response = buildDummyAuthResponseDE(randomGivenName, randomFamilyName,
+        randomPseudonym,
+        randomDate, randomPlaceOfBirth, randomBirthName);
     TestRequestImpl pendingReq1 = new TestRequestImpl();
     pendingReq1.getSessionData(AuthProcessDataWrapper.class)
         .setGenericDataToSession(Constants.DATA_FULL_EIDAS_RESPONSE, response);
     Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
     Mockito.when(zmrClient.searchDeSpecific(randomGivenName, randomFamilyName, randomDate, randomPlaceOfBirth,
-            randomBirthName))
-            .thenReturn(Collections.singletonList(new RegisterResult(randomBpk, randomPseudonym, randomGivenName,
-                    randomFamilyName, randomDate, randomPlaceOfBirth, randomBirthName,null, null)));
+        randomBirthName))
+        .thenReturn(Collections.singletonList(new RegisterResult(randomBpk, randomPseudonym, randomGivenName,
+            randomFamilyName, randomDate, randomPlaceOfBirth, randomBirthName, null, null)));
     Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
-    task = new InitialSearchTask(Collections.singletonList(new DeSpecificDetailSearchProcessor(ernpClient, zmrClient)),
-            ernpClient, zmrClient);
+    task = new InitialSearchTask(
+        Collections.singletonList(new DeSpecificDetailSearchProcessor(ernpClient, zmrClient)),
+        ernpClient, zmrClient);
 
     task.execute(pendingReq1, executionContext);
 
     String resultBpk = (String)
-        pendingReq1.getSessionData(AuthProcessDataWrapper.class).getGenericDataFromSession(Constants.DATA_RESULT_MATCHING_BPK);
+        pendingReq1.getSessionData(AuthProcessDataWrapper.class)
+            .getGenericDataFromSession(Constants.DATA_RESULT_MATCHING_BPK);
     Assert.assertEquals("Wrong bpk", resultBpk, randomBpk);
   }
 
@@ -306,29 +307,30 @@ public class InitialSearchTaskFirstTest {
   @Test
   @DirtiesContext
   public void testNode104_ManualFixNecessary_DE() throws Exception {
-    String pseudonym1 = DE_ST + RandomStringUtils.randomNumeric(5);
-    String pseudonym2 = pseudonym1 + RandomStringUtils.randomNumeric(2);
-    String bpk1 = RandomStringUtils.randomNumeric(5);
-    String bpk2 = bpk1 + RandomStringUtils.randomNumeric(2);
-    final AuthenticationResponse response = buildDummyAuthResponseDE(randomGivenName, randomFamilyName, pseudonym1,
-            randomDate, randomPlaceOfBirth, randomBirthName);
+    String newRandomPseudonym = randomPseudonym + RandomStringUtils.randomNumeric(2);
+    String newRandomBpk = randomBpk + RandomStringUtils.randomNumeric(6);
+    final AuthenticationResponse response = buildDummyAuthResponseDE(randomGivenName, randomFamilyName,
+        randomPseudonym,
+        randomDate, randomPlaceOfBirth, randomBirthName);
     TestRequestImpl pendingReq1 = new TestRequestImpl();
     pendingReq1.getSessionData(AuthProcessDataWrapper.class)
         .setGenericDataToSession(Constants.DATA_FULL_EIDAS_RESPONSE, response);
     Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
     ArrayList<RegisterResult> zmrResultSpecific = new ArrayList<>();
-    zmrResultSpecific.add(new RegisterResult(bpk1, pseudonym1, randomGivenName, randomFamilyName, randomDate,
-            randomPlaceOfBirth, randomBirthName,null, null));
-    zmrResultSpecific.add(new RegisterResult(bpk2, pseudonym2, randomGivenName, randomFamilyName, randomDate,
-            randomPlaceOfBirth, randomBirthName,null, null));
+    zmrResultSpecific.add(
+        new RegisterResult(randomBpk, randomPseudonym, randomGivenName, randomFamilyName, randomDate,
+            randomPlaceOfBirth, randomBirthName, null, null));
+    zmrResultSpecific.add(new RegisterResult(newRandomBpk, newRandomPseudonym, randomGivenName, randomFamilyName, randomDate,
+        randomPlaceOfBirth, randomBirthName, null, null));
     Mockito.when(zmrClient.searchDeSpecific(randomGivenName, randomFamilyName, randomDate, randomPlaceOfBirth,
-            randomBirthName)).thenReturn(zmrResultSpecific);
+        randomBirthName)).thenReturn(zmrResultSpecific);
     Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
-    task = new InitialSearchTask(Collections.singletonList(new DeSpecificDetailSearchProcessor(ernpClient, zmrClient)),
-            ernpClient, zmrClient);
+    task = new InitialSearchTask(
+        Collections.singletonList(new DeSpecificDetailSearchProcessor(ernpClient, zmrClient)),
+        ernpClient, zmrClient);
 
     TaskExecutionException exception = assertThrows(TaskExecutionException.class,
-            () -> task.execute(pendingReq1, executionContext));
+        () -> task.execute(pendingReq1, executionContext));
 
     Throwable origE = exception.getOriginalException();
     Assert.assertTrue("Wrong exception", (origE.getCause() instanceof ManualFixNecessaryException));
@@ -340,24 +342,28 @@ public class InitialSearchTaskFirstTest {
   @Test
   @DirtiesContext
   public void testNode104_ManualFixNecessary_IT() throws Exception {
-    String fakeTaxNumber = RandomStringUtils.randomNumeric(14);
-    final AuthenticationResponse response = buildDummyAuthResponseRandomPersonIT_Tax(fakeTaxNumber);
+    String randomTaxNumber = RandomStringUtils.randomNumeric(14);
+    final AuthenticationResponse response = buildDummyAuthResponseRandomPersonIT_Tax(randomTaxNumber);
     TestRequestImpl pendingReq1 = new TestRequestImpl();
     pendingReq1.getSessionData(AuthProcessDataWrapper.class)
         .setGenericDataToSession(Constants.DATA_FULL_EIDAS_RESPONSE, response);
     Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
     ArrayList<RegisterResult> zmrResultSpecific = new ArrayList<>();
-    zmrResultSpecific.add(new RegisterResult("bpkMax", IT_ST+randomIdentifier+"4", randomGivenName,
-            randomFamilyName, randomDate, null, null, fakeTaxNumber, null));
-    zmrResultSpecific.add(new RegisterResult("bpkMax1", IT_ST+randomIdentifier+"5", randomGivenName,
-            randomFamilyName, randomDate, null, null, fakeTaxNumber, null));
-    Mockito.when(zmrClient.searchItSpecific(fakeTaxNumber)).thenReturn(zmrResultSpecific);
+    String randomPseudonym = IT_ST + randomIdentifier + "4";
+    zmrResultSpecific.add(new RegisterResult(randomBpk, randomPseudonym, randomGivenName,
+        randomFamilyName, randomDate, null, null, randomTaxNumber, null));
+    String newRandomPseudonym = IT_ST + randomIdentifier + "5";
+    String newRandomBpk = RandomStringUtils.randomNumeric(6);
+    zmrResultSpecific.add(new RegisterResult(newRandomBpk, newRandomPseudonym, randomGivenName,
+        randomFamilyName, randomDate, null, null, randomTaxNumber, null));
+    Mockito.when(zmrClient.searchItSpecific(randomTaxNumber)).thenReturn(zmrResultSpecific);
     Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
-    task = new InitialSearchTask(Collections.singletonList(new ItSpecificDetailSearchProcessor(ernpClient, zmrClient)),
-            ernpClient, zmrClient);
+    task = new InitialSearchTask(
+        Collections.singletonList(new ItSpecificDetailSearchProcessor(ernpClient, zmrClient)),
+        ernpClient, zmrClient);
 
     TaskExecutionException exception = assertThrows(TaskExecutionException.class,
-            () -> task.execute(pendingReq1, executionContext));
+        () -> task.execute(pendingReq1, executionContext));
 
     Throwable origE = exception.getOriginalException();
     Assert.assertTrue("Wrong exception", (origE.getCause() instanceof ManualFixNecessaryException));
@@ -375,19 +381,21 @@ public class InitialSearchTaskFirstTest {
     task.execute(pendingReq, executionContext);
 
     String bPk = (String)
-        pendingReq.getSessionData(AuthProcessDataWrapper.class).getGenericDataFromSession(Constants.DATA_RESULT_MATCHING_BPK);
+        pendingReq.getSessionData(AuthProcessDataWrapper.class)
+            .getGenericDataFromSession(Constants.DATA_RESULT_MATCHING_BPK);
     Assert.assertEquals("Wrong bpk", "TODO-Temporary-Endnode-105", bPk);
   }
 
 
   @NotNull
   private AuthenticationResponse buildDummyAuthResponseRandomPerson() throws URISyntaxException {
-    return buildDummyAuthResponse(randomGivenName, randomFamilyName, DE_ST+randomIdentifier, randomDate);
+    return buildDummyAuthResponse(randomGivenName, randomFamilyName, DE_ST + randomIdentifier, randomDate);
   }
 
-  private AuthenticationResponse buildDummyAuthResponseRandomPersonIT_Tax(String taxNumber) throws URISyntaxException {
-    return buildDummyAuthResponse(randomGivenName, randomFamilyName, IT_ST+randomIdentifier, randomDate,
-            taxNumber, null, null);
+  private AuthenticationResponse buildDummyAuthResponseRandomPersonIT_Tax(String taxNumber)
+      throws URISyntaxException {
+    return buildDummyAuthResponse(randomGivenName, randomFamilyName, IT_ST + randomIdentifier, randomDate,
+        taxNumber, null, null);
   }
 
   @NotNull
@@ -408,18 +416,19 @@ public class InitialSearchTaskFirstTest {
                                                         String dateOfBirth, String taxNumber, String placeOfBirth,
                                                         String birthName) throws URISyntaxException {
     ImmutableAttributeMap.Builder builder = ImmutableAttributeMap.builder()
-        .put(generateStringAttribute(Constants.eIDAS_ATTR_PERSONALIDENTIFIER,"ff","af"), identifier)
-        .put(generateStringAttribute(Constants.eIDAS_ATTR_CURRENTFAMILYNAME,"fff","aff"), familyName)
-        .put(generateStringAttribute(Constants.eIDAS_ATTR_CURRENTGIVENNAME,"ffff","afff"), givenName)
-        .put(generateDateTimeAttribute(Constants.eIDAS_ATTR_DATEOFBIRTH,"fffff","affff"), dateOfBirth);
+        .put(generateStringAttribute(Constants.eIDAS_ATTR_PERSONALIDENTIFIER, "ff", "af"), identifier)
+        .put(generateStringAttribute(Constants.eIDAS_ATTR_CURRENTFAMILYNAME, "fff", "aff"), familyName)
+        .put(generateStringAttribute(Constants.eIDAS_ATTR_CURRENTGIVENNAME, "ffff", "afff"), givenName)
+        .put(generateDateTimeAttribute(Constants.eIDAS_ATTR_DATEOFBIRTH, "fffff", "affff"), dateOfBirth);
     if (taxNumber != null) {
-      builder.put(generateStringAttribute(Constants.eIDAS_ATTR_TAXREFERENCE,"ffffff","afffff"), taxNumber);
+      builder.put(generateStringAttribute(Constants.eIDAS_ATTR_TAXREFERENCE, "ffffff", "afffff"), taxNumber);
     }
     if (birthName != null) {
-      builder.put(generateStringAttribute(Constants.eIDAS_ATTR_BIRTHNAME,"fffffff","affffff"), birthName);
+      builder.put(generateStringAttribute(Constants.eIDAS_ATTR_BIRTHNAME, "fffffff", "affffff"), birthName);
     }
     if (placeOfBirth != null) {
-      builder.put(generateStringAttribute(Constants.eIDAS_ATTR_PLACEOFBIRTH,"ffffffff","afffffff"), placeOfBirth);
+      builder.put(generateStringAttribute(Constants.eIDAS_ATTR_PLACEOFBIRTH, "ffffffff", "afffffff"),
+          placeOfBirth);
     }
     final ImmutableAttributeMap attributeMap = builder.build();
 
@@ -428,18 +437,20 @@ public class InitialSearchTaskFirstTest {
         "afaf").attributes(attributeMap).build();
   }
 
-  private AttributeDefinition<Object> generateStringAttribute(String friendlyName, String fragment, String prefix) throws URISyntaxException {
+  private AttributeDefinition<Object> generateStringAttribute(String friendlyName, String fragment, String prefix)
+      throws URISyntaxException {
     return generateAttribute(friendlyName, fragment, prefix, "eu.eidas.auth.commons.attribute.impl" +
         ".LiteralStringAttributeValueMarshaller");
   }
 
-  private AttributeDefinition<Object> generateDateTimeAttribute(String friendlyName, String fragment, String prefix) throws URISyntaxException {
+  private AttributeDefinition<Object> generateDateTimeAttribute(String friendlyName, String fragment, String prefix)
+      throws URISyntaxException {
     return generateAttribute(friendlyName, fragment, prefix, "eu.eidas.auth.commons.attribute.impl" +
         ".DateTimeAttributeValueMarshaller");
   }
 
   private AttributeDefinition<Object> generateAttribute(String friendlyName, String fragment, String prefix,
-                                                String marshaller) throws URISyntaxException {
+                                                        String marshaller) throws URISyntaxException {
     return AttributeDefinition.builder()
         .friendlyName(friendlyName).nameUri(new URI("ad", "sd", fragment))
         .personType(PersonType.LEGAL_PERSON).xmlType(new QName("http://saf", "as", prefix))
-- 
cgit v1.2.3


From eae2f7b06fc41741863d1ea6ec9c8b6da8a6b8fb Mon Sep 17 00:00:00 2001
From: Christian Kollmann <christian.kollmann@a-sit.at>
Date: Tue, 12 Jan 2021 15:51:07 +0100
Subject: Add null check for more safety

---
 .../eidas/specific/modules/auth/eidas/v2/utils/EidasResponseUtils.java  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/utils/EidasResponseUtils.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/utils/EidasResponseUtils.java
index 3cf73944..aafcd8b9 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/utils/EidasResponseUtils.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/utils/EidasResponseUtils.java
@@ -307,7 +307,7 @@ public class EidasResponseUtils {
     }
     final Triple<String, String, String> eIdentifier =
         EidasResponseUtils.parseEidasPersonalIdentifier((String) personalIdObj);
-    if (eIdentifier.getThird() == null) {
+    if (eIdentifier == null || eIdentifier.getThird() == null) {
       throw new EidasAttributeException("Error processing eIdentifier");
     }
     return eIdentifier.getThird();
-- 
cgit v1.2.3