From 31e135a9ffb7e20fa146f841c5e3a2782f8131a5 Mon Sep 17 00:00:00 2001 From: Parshad Patel Date: Mon, 19 Aug 2019 14:33:27 +0900 Subject: Reduce number of parameters in constructor Constructor has 52 parameters, which is greater than 7 authorized Issue-ID: PORTAL-562 Change-Id: Iaee1a1593adb6b8f74decc852af34301c23a5761 Signed-off-by: Parshad Patel --- .../ExternalAccessRolesControllerTest.java | 25 +++++++++++++--------- .../portal/transport/CentralUserTest.java | 15 +++++++++---- 2 files changed, 26 insertions(+), 14 deletions(-) (limited to 'ecomp-portal-BE-common/src/test/java/org/onap') diff --git a/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/ExternalAccessRolesControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/ExternalAccessRolesControllerTest.java index 3373ef92..3d30f9f5 100644 --- a/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/ExternalAccessRolesControllerTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/ExternalAccessRolesControllerTest.java @@ -68,11 +68,7 @@ import org.onap.portalapp.portal.ecomp.model.PortalRestStatusEnum; import org.onap.portalapp.portal.framework.MockitoTestSuite; import org.onap.portalapp.portal.service.ExternalAccessRolesService; import org.onap.portalapp.portal.service.ExternalAccessRolesServiceImpl; -import org.onap.portalapp.portal.transport.CentralRole; -import org.onap.portalapp.portal.transport.CentralRoleFunction; -import org.onap.portalapp.portal.transport.CentralUser; -import org.onap.portalapp.portal.transport.CentralV2Role; -import org.onap.portalapp.portal.transport.ExternalRequestFieldsValidator; +import org.onap.portalapp.portal.transport.*; import org.onap.portalapp.portal.utils.EPCommonSystemProperties; import org.onap.portalapp.portal.utils.EcompPortalUtils; import org.onap.portalapp.portal.utils.PortalConstants; @@ -151,11 +147,20 @@ public class ExternalAccessRolesControllerTest { @Test public void getUserTest() throws Exception { - CentralUser expectedCentralUser = new CentralUser(null, null, null, null, null, null, null, null, loginId, - loginId, loginId, loginId, loginId, loginId, loginId, null, loginId, loginId, loginId, loginId, loginId, - loginId, loginId, loginId, loginId, loginId, loginId, loginId, loginId, loginId, loginId, loginId, - loginId, loginId, loginId, loginId, loginId, loginId, loginId, loginId, loginId, loginId, loginId, - loginId, null, false, false, null, null, false, loginId, null); + CentralUser expectedCentralUser = + new CentralUser.CentralUserBuilder().setId(null).setCreated(null).setModified(null).setCreatedId(null) + .setModifiedId(null).setRowNum(null).setOrgId(null).setManagerId(null).setFirstName(loginId) + .setMiddleInitial(loginId).setLastName(loginId).setPhone(loginId).setFax(loginId) + .setCellular(loginId).setEmail(loginId).setAddressId(null).setAlertMethodCd(loginId) + .setHrid(loginId).setOrgUserId(loginId).setOrgCode(loginId).setAddress1(loginId) + .setAddress2(loginId).setCity(loginId).setState(loginId).setZipCode(loginId).setCountry(loginId) + .setOrgManagerUserId(loginId).setLocationClli(loginId).setBusinessCountryCode(loginId) + .setBusinessCountryName(loginId).setBusinessUnit(loginId).setBusinessUnitName(loginId) + .setDepartment(loginId).setDepartmentName(loginId).setCompanyCode(loginId).setCompany(loginId) + .setZipCodeSuffix(loginId).setJobTitle(loginId).setCommandChain(loginId).setSiloStatus(loginId) + .setCostCenter(loginId).setFinancialLocCode(loginId).setLoginId(loginId).setLoginPwd(loginId) + .setLastLoginDate(null).setActive(false).setInternal(false).setSelectedProfileId(null) + .setTimeZoneId(null).setOnline(false).setChatId(loginId).setUserApps(null).createCentralUser(); String loginId = "test"; StringWriter sw = new StringWriter(); PrintWriter writer = new PrintWriter(sw); diff --git a/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/CentralUserTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/CentralUserTest.java index b8c019b0..28292ba6 100644 --- a/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/CentralUserTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/transport/CentralUserTest.java @@ -44,13 +44,20 @@ import java.util.HashSet; import java.util.Set; import org.junit.Test; -import org.onap.portalapp.portal.transport.CentralV2Role; -import org.onap.portalapp.portal.transport.CentralV2User; -import org.onap.portalapp.portal.transport.CentralV2UserApp; public class CentralUserTest { - CentralUser centralUser=new CentralUser(null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, false, false, null, null, false, null, null); + CentralUser centralUser = new CentralUser.CentralUserBuilder().setId(null).setCreated(null).setModified(null) + .setCreatedId(null).setModifiedId(null).setRowNum(null).setOrgId(null).setManagerId(null).setFirstName(null) + .setMiddleInitial(null).setLastName(null).setPhone(null).setFax(null).setCellular(null).setEmail(null) + .setAddressId(null).setAlertMethodCd(null).setHrid(null).setOrgUserId(null).setOrgCode(null) + .setAddress1(null).setAddress2(null).setCity(null).setState(null).setZipCode(null).setCountry(null) + .setOrgManagerUserId(null).setLocationClli(null).setBusinessCountryCode(null).setBusinessCountryName(null) + .setBusinessUnit(null).setBusinessUnitName(null).setDepartment(null).setDepartmentName(null) + .setCompanyCode(null).setCompany(null).setZipCodeSuffix(null).setJobTitle(null).setCommandChain(null) + .setSiloStatus(null).setCostCenter(null).setFinancialLocCode(null).setLoginId(null).setLoginPwd(null) + .setLastLoginDate(null).setActive(false).setInternal(false).setSelectedProfileId(null).setTimeZoneId(null) + .setOnline(false).setChatId(null).setUserApps(null).createCentralUser(); public CentralV2User mockCentralUser(){ Set userApps = new HashSet(); -- cgit 1.2.3-korg