diff options
author | Jim Hahn <jrh3@att.com> | 2019-07-01 15:14:19 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-07-01 15:14:19 +0000 |
commit | 6a046075ff25a199be7a6346e4e56bbd81c362b7 (patch) | |
tree | 906b423ebe4f002c4365e3a5c632cdcd254355c0 /ONAP-PAP-REST/src/test/java/org/onap | |
parent | 86554962a34c4e7c16821f91a12242a4ffb36368 (diff) | |
parent | 95b23fd523f72ef52c8555ce6947294a43f099dd (diff) |
Merge "Adding logging to JUnit"1.5.0
Diffstat (limited to 'ONAP-PAP-REST/src/test/java/org/onap')
-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()); } } |