From 19087734d0cd4d7e7c892490a795b01e93ba00d0 Mon Sep 17 00:00:00 2001 From: "Lott, Christopher (cl778h)" Date: Mon, 29 Jul 2019 11:41:36 -0400 Subject: Publish fixed strings as public constants Change-Id: I47c8458a0f16251ef19043eb63cf5f392990efdf Issue-ID: PORTAL-657 Signed-off-by: Lott, Christopher (cl778h) --- .../core/onboarding/util/AuthUtilTest.java | 23 +++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'ecomp-sdk/epsdk-fw/src/test/java/org/onap/portalsdk/core/onboarding/util') diff --git a/ecomp-sdk/epsdk-fw/src/test/java/org/onap/portalsdk/core/onboarding/util/AuthUtilTest.java b/ecomp-sdk/epsdk-fw/src/test/java/org/onap/portalsdk/core/onboarding/util/AuthUtilTest.java index 00745922..ec3135f1 100644 --- a/ecomp-sdk/epsdk-fw/src/test/java/org/onap/portalsdk/core/onboarding/util/AuthUtilTest.java +++ b/ecomp-sdk/epsdk-fw/src/test/java/org/onap/portalsdk/core/onboarding/util/AuthUtilTest.java @@ -48,6 +48,7 @@ import org.junit.Test; import org.mockito.InjectMocks; import org.mockito.Mockito; import org.onap.aaf.cadi.CadiWrap; +import org.onap.portalsdk.core.onboarding.crossapi.IPortalRestCentralService; import org.onap.portalsdk.core.onboarding.exception.PortalAPIException; public class AuthUtilTest { @@ -77,29 +78,29 @@ public class AuthUtilTest { @Test(expected = PortalAPIException.class) public void isAccessAllowedExceptionTest() throws PortalAPIException { Map appCreds = new HashMap<>(); - appCreds.put("username", "test"); - appCreds.put("password", "test1"); + appCreds.put(IPortalRestCentralService.CREDENTIALS_USER, "test"); + appCreds.put(IPortalRestCentralService.CREDENTIALS_PASS, "test1"); AuthUtil.isAccessAllowed(request, "com.test", appCreds); } @Test public void isAccessAllowedTest() throws PortalAPIException { - Mockito.when(request.getHeader("username")).thenReturn("test"); - Mockito.when(request.getHeader("password")).thenReturn("test1"); + Mockito.when(request.getHeader(IPortalRestCentralService.CREDENTIALS_USER)).thenReturn("test"); + Mockito.when(request.getHeader(IPortalRestCentralService.CREDENTIALS_PASS)).thenReturn("test1"); Map appCreds = new HashMap<>(); - appCreds.put("username", "test"); - appCreds.put("password", "test1"); + appCreds.put(IPortalRestCentralService.CREDENTIALS_USER, "test"); + appCreds.put(IPortalRestCentralService.CREDENTIALS_PASS, "test1"); assertTrue(AuthUtil.isAccessAllowed(request, "com.test", appCreds)); } @Test public void isAccessAllowedFalseTest() throws PortalAPIException { - Mockito.when(request.getHeader("username")).thenReturn("test"); - Mockito.when(request.getHeader("password")).thenReturn("test1"); + Mockito.when(request.getHeader(IPortalRestCentralService.CREDENTIALS_USER)).thenReturn("test"); + Mockito.when(request.getHeader(IPortalRestCentralService.CREDENTIALS_PASS)).thenReturn("test1"); Map appCreds = new HashMap<>(); - appCreds.put("username", "test"); - appCreds.put("password", "test123"); - appCreds.put("appName", "testApp"); + appCreds.put(IPortalRestCentralService.CREDENTIALS_USER, "test"); + appCreds.put(IPortalRestCentralService.CREDENTIALS_PASS, "test123"); + appCreds.put(IPortalRestCentralService.CREDENTIALS_APP, "testApp"); assertFalse(AuthUtil.isAccessAllowed(request, "com.test", appCreds)); } -- cgit 1.2.3-korg