diff options
Diffstat (limited to 'ecomp-portal-BE-os/src/test/java')
-rw-r--r-- | ecomp-portal-BE-os/src/test/java/org/onap/portalapp/portal/controller/LoginControllerTest.java | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/ecomp-portal-BE-os/src/test/java/org/onap/portalapp/portal/controller/LoginControllerTest.java b/ecomp-portal-BE-os/src/test/java/org/onap/portalapp/portal/controller/LoginControllerTest.java index 4af05344..f7c9ce35 100644 --- a/ecomp-portal-BE-os/src/test/java/org/onap/portalapp/portal/controller/LoginControllerTest.java +++ b/ecomp-portal-BE-os/src/test/java/org/onap/portalapp/portal/controller/LoginControllerTest.java @@ -114,6 +114,7 @@ public class LoginControllerTest { HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse(); NullPointerException nullPointerException = new NullPointerException(); + private DelegatingServletInputStream dsi; @Test public void loginIfAuthNullTest() { @@ -151,8 +152,8 @@ public class LoginControllerTest { HttpServletResponse response = mock(HttpServletResponse.class); HttpSession session = mock(HttpSession.class); String json = "{\"loginId\":\"test\", \"password\":\"xyz\"}"; - when(request.getInputStream()).thenReturn( - new DelegatingServletInputStream(new ByteArrayInputStream(json.getBytes(StandardCharsets.UTF_8)))); + dsi = new DelegatingServletInputStream(new ByteArrayInputStream(json.getBytes(StandardCharsets.UTF_8))); + when(request.getInputStream()).thenReturn(dsi); when(request.getReader()).thenReturn(new BufferedReader(new StringReader(json))); when(request.getContentType()).thenReturn("application/json"); when(request.getCharacterEncoding()).thenReturn("UTF-8"); |