From 2e1cf80017cafcc02824c686ea4722acbc3fd78a Mon Sep 17 00:00:00 2001 From: econwar Date: Tue, 28 Aug 2018 09:57:05 +0000 Subject: Make StatisticsTests test real methods Change-Id: I5f3d73d78fafd3eb877029b202ea2bbbcf936dc4 Signed-off-by: Conor Ward Issue-ID: DMAAP-101 --- .../onap/dmaap/datarouter/provisioning/StatisticsServletTest.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/StatisticsServletTest.java b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/StatisticsServletTest.java index 0a9632eb..0babdc47 100755 --- a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/StatisticsServletTest.java +++ b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/StatisticsServletTest.java @@ -105,6 +105,8 @@ public class StatisticsServletTest extends DrServletTestBase { when(response.getOutputStream()).thenReturn(outStream); statisticsServlet = PowerMockito.mock(StatisticsServlet.class); PowerMockito.doReturn(null).when(statisticsServlet, "getRecordsForSQL", anyString()); + PowerMockito.doCallRealMethod().when(statisticsServlet, "buildMapFromRequest", anyObject()); + PowerMockito.doCallRealMethod().when(statisticsServlet, "getTimeFromParam", anyString()); doNothing().when(statisticsServlet).rsToCSV(anyObject(), anyObject()); doCallRealMethod().when(statisticsServlet).doGet(request, response); when(statisticsServlet.getFeedIdsByGroupId(anyInt())).thenReturn(new StringBuffer("1")); @@ -116,10 +118,13 @@ public class StatisticsServletTest extends DrServletTestBase { public void Given_Request_Is_HTTP_GET_With_GroupId_And_FeedId_Parameters_Then_Request_Succeeds() throws Exception { when(request.getParameter("feedid")).thenReturn("1"); + when(request.getParameter("statusCode")).thenReturn("500"); ServletOutputStream outStream = mock(ServletOutputStream.class); when(response.getOutputStream()).thenReturn(outStream); statisticsServlet = PowerMockito.mock(StatisticsServlet.class); PowerMockito.doReturn(null).when(statisticsServlet, "getRecordsForSQL", anyString()); + PowerMockito.doCallRealMethod().when(statisticsServlet, "buildMapFromRequest", anyObject()); + PowerMockito.doCallRealMethod().when(statisticsServlet, "getTimeFromParam", anyString()); doNothing().when(statisticsServlet).rsToCSV(anyObject(), anyObject()); doCallRealMethod().when(statisticsServlet).doGet(request, response); doCallRealMethod().when(statisticsServlet).queryGeneretor(anyObject()); -- cgit 1.2.3-korg