diff options
author | Christian Kollmann <christian.kollmann@a-sit.at> | 2021-01-12 15:08:17 +0100 |
---|---|---|
committer | Christian Kollmann <christian.kollmann@a-sit.at> | 2021-01-12 15:15:51 +0100 |
commit | fb99ff15185b4f3b10d4c72270787b04281494bf (patch) | |
tree | e37b8de6a1fcbde6ea944b6a04612a2d3ddb682e /eidas_modules | |
parent | 50c82048f034803a3486368d2c5cb3ad09eb07b3 (diff) | |
download | National_eIDAS_Gateway-fb99ff15185b4f3b10d4c72270787b04281494bf.tar.gz National_eIDAS_Gateway-fb99ff15185b4f3b10d4c72270787b04281494bf.tar.bz2 National_eIDAS_Gateway-fb99ff15185b4f3b10d4c72270787b04281494bf.zip |
Use generic list types in parameters and return types
List instead of ArrayList allows for easier mocking and stubbing
Diffstat (limited to 'eidas_modules')
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) |