### Question:
StatisticsController implements Constants { @RequestMapping(path = "/v1/statsdetails", method = RequestMethod.GET) @ResponseBody public ResponseEntity<Object> getStatsDetails() { ResponseVO response; try { response = new ResponseVO(statsService.getStats()); } catch (Exception e) { LOGGER.error("Error fetching stats details", e); return ResponseUtils.buildFailureResponse(e); } return ResponseUtils.buildSucessResponse(response); }  @RequestMapping(path = "/v1/cpu-utilization", method = RequestMethod.GET) ResponseEntity<Object> getCPUUtilization(@RequestParam("ag") String assetGroup); @RequestMapping(path = "/v1/network-utilization", method = RequestMethod.GET) ResponseEntity<Object> getNetworkUtilization(@RequestParam("ag") String assetGroup); @RequestMapping(path = "/v1/disk-utilization", method = RequestMethod.GET) ResponseEntity<Object> getDiskUtilization(@RequestParam("ag") String assetGroup); @RequestMapping(path = "/v1/statsdetails", method = RequestMethod.GET) @ResponseBody ResponseEntity<Object> getStatsDetails(); @RequestMapping(path = "/v1/autofixstats", method = RequestMethod.GET) @ResponseBody ResponseEntity<Object> getAutofixStats();  }### Answer:
@Test public void getStatsDetailsTest() throws Exception { when(statsService.getStats()).thenReturn(new ArrayList<Map<String,Object>>()); ResponseEntity<Object> response = statisticsController.getStatsDetails(); assert(response.getStatusCodeValue()==200); }
@Test public void getStatsDetailsExceptionTest() throws Exception { when(statsService.getStats()).thenThrow( new ServiceException()); ResponseEntity<Object> response = statisticsController.getStatsDetails(); assert(response.getStatusCodeValue()!=200); }