diff options
author | Pamela Dragosh <pdragosh@research.att.com> | 2019-06-28 17:21:13 -0400 |
---|---|---|
committer | Pamela Dragosh <pdragosh@research.att.com> | 2019-06-28 17:21:23 -0400 |
commit | 95b23fd523f72ef52c8555ce6947294a43f099dd (patch) | |
tree | 84c0d3b7403f9075eb877b6c7aad5d7847cecf13 /ONAP-PAP-REST/src/test/java/org | |
parent | c5f234ca60840a1de8c9486c51226e6a294c57f3 (diff) |
Adding logging to JUnit
Turning on logging.
Issue-ID: POLICY-1876
Change-Id: I82b04609a07f5d33c88c3e0068959de1e628cb38
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
Diffstat (limited to 'ONAP-PAP-REST/src/test/java/org')
-rw-r--r-- | ONAP-PAP-REST/src/test/java/org/onap/policy/pap/test/XACMLPAPTest.java | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/test/XACMLPAPTest.java b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/test/XACMLPAPTest.java index 6ebc74a91..fd0c157fe 100644 --- a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/test/XACMLPAPTest.java +++ b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/test/XACMLPAPTest.java @@ -127,6 +127,7 @@ public class XACMLPAPTest { public void testInit() { httpServletRequest = Mockito.mock(HttpServletRequest.class); httpServletResponse = Mockito.mock(MockHttpServletResponse.class); + logger.info(httpServletResponse); Mockito.when(httpServletRequest.getHeaderNames()).thenReturn(Collections.enumeration(headers)); Mockito.when(httpServletRequest.getAttributeNames()).thenReturn(Collections.enumeration(headers)); CommonClassDaoImpl.setSessionfactory(sessionFactory); @@ -163,7 +164,8 @@ public class XACMLPAPTest { MockServletInputStream mockInput = new MockServletInputStream(PolicyUtils.objectToJsonString(newPAPPolicy).getBytes()); Mockito.when(httpServletRequest.getInputStream()).thenReturn(mockInput); - + logger.info(httpServletRequest); + logger.info(httpServletResponse); pap.service(httpServletRequest, httpServletResponse); Mockito.verify(httpServletResponse).addHeader("operation", "create"); } @@ -192,6 +194,8 @@ public class XACMLPAPTest { Mockito.when(httpServletRequest.getInputStream()).thenReturn(mockInput); setPolicyCreation(); + logger.info(httpServletRequest); + logger.info(httpServletResponse); pap.service(httpServletRequest, httpServletResponse); Mockito.verify(httpServletResponse).addHeader("operation", "create"); } @@ -215,6 +219,8 @@ public class XACMLPAPTest { Mockito.when(httpServletRequest.getInputStream()).thenReturn(mockInput); setPolicyCreation(); + logger.info(httpServletRequest); + logger.info(httpServletResponse); pap.service(httpServletRequest, httpServletResponse); Mockito.verify(httpServletResponse).addHeader("operation", "create"); } @@ -238,6 +244,8 @@ public class XACMLPAPTest { Mockito.when(httpServletRequest.getInputStream()).thenReturn(mockInput); setPolicyCreation(); + logger.info(httpServletRequest); + logger.info(httpServletResponse); pap.service(httpServletRequest, httpServletResponse); Mockito.verify(httpServletResponse).addHeader("operation", "create"); } @@ -257,6 +265,8 @@ public class XACMLPAPTest { new MockServletInputStream(PolicyUtils.objectToJsonString(newPAPPolicy).getBytes()); Mockito.when(httpServletRequest.getInputStream()).thenReturn(mockInput); + logger.info(httpServletRequest); + logger.info(httpServletResponse); pap.service(httpServletRequest, httpServletResponse); Mockito.verify(httpServletResponse).addHeader("operation", "create"); } @@ -287,6 +297,8 @@ public class XACMLPAPTest { new MockServletInputStream(PolicyUtils.objectToJsonString(newPAPPolicy).getBytes()); Mockito.when(httpServletRequest.getInputStream()).thenReturn(mockInput); + logger.info(httpServletRequest); + logger.info(httpServletResponse); pap.service(httpServletRequest, httpServletResponse); Mockito.verify(httpServletResponse).addHeader("operation", "create"); } @@ -318,6 +330,8 @@ public class XACMLPAPTest { new MockServletInputStream(PolicyUtils.objectToJsonString(newPAPPolicy).getBytes()); Mockito.when(httpServletRequest.getInputStream()).thenReturn(mockInput); + logger.info(httpServletRequest); + logger.info(httpServletResponse); pap.service(httpServletRequest, httpServletResponse); Mockito.verify(httpServletResponse).addHeader("operation", "create"); } @@ -346,6 +360,8 @@ public class XACMLPAPTest { new MockServletInputStream(PolicyUtils.objectToJsonString(newPAPPolicy).getBytes()); Mockito.when(httpServletRequest.getInputStream()).thenReturn(mockInput); + logger.info(httpServletRequest); + logger.info(httpServletResponse); pap.service(httpServletRequest, httpServletResponse); Mockito.verify(httpServletResponse).addHeader("operation", "create"); } @@ -369,6 +385,8 @@ public class XACMLPAPTest { new MockServletInputStream(PolicyUtils.objectToJsonString(newPAPPolicy).getBytes()); Mockito.when(httpServletRequest.getInputStream()).thenReturn(mockInput); + logger.info(httpServletRequest); + logger.info(httpServletResponse); pap.service(httpServletRequest, httpServletResponse); Mockito.verify(httpServletResponse).addHeader("operation", "create"); } @@ -425,6 +443,8 @@ public class XACMLPAPTest { new MockServletInputStream(PolicyUtils.objectToJsonString(newPapPolicy).getBytes()); Mockito.when(httpServletRequest.getInputStream()).thenReturn(mockInput); + logger.info(httpServletRequest); + logger.info(httpServletResponse); pap.service(httpServletRequest, httpServletResponse); Mockito.verify(httpServletResponse).addHeader("operation", "create"); } @@ -897,14 +917,14 @@ public class XACMLPAPTest { try { Mockito.when(httpServletResponse.getOutputStream()).thenReturn(mockOutput); } catch (IOException e) { - fail(); + fail(e.getMessage()); } try { pap.service(httpServletRequest, httpServletResponse); assertTrue(true); } catch (Exception e) { - fail(); + fail(e.getMessage()); } } |