### Question:
PatchingController implements Constants { @RequestMapping(path = "/v1/patching/progress", method = RequestMethod.POST) public ResponseEntity<Object> getPatchingProgress(@RequestBody(required = true) PatchingRequest request) { Map<String, Object> response = new HashMap<>(); String assetGroup = request.getAg(); int quarter = request.getQuarter(); int year = request.getYear(); if (Strings.isNullOrEmpty(assetGroup)) { return ResponseUtils.buildFailureResponse(new ServiceException(ASSET_MANDATORY)); } if (year == 0) { year = patchingService.getOngoingYear(); } if (quarter == 0) { quarter = patchingService.getOngoingQuarter(); } if (!(quarter >= 1 && quarter <= FOUR)) { return ResponseUtils.buildFailureResponse(new ServiceException( "Quarter number should be one out of 1,2,3,4")); } if (!(year >= START_YEAR && year <= LAST_YEAR)) { return ResponseUtils.buildFailureResponse(new ServiceException("Year should be in between 1900 and 2100")); } try { Map<String, Object> patchProgressList = patchingService.getPatchingProgress(assetGroup, year, quarter); response.put("response", patchProgressList); } catch (ServiceException e) { LOGGER.error("ServiceException in getPatchingProgress ",e); return complianceService.formatException(e); } return ResponseUtils.buildSucessResponse(response); }  @RequestMapping(path = "/v1/patching/topnoncompliantapps", method = RequestMethod.GET) ResponseEntity<Object> getTopNonCompliantApps(@RequestParam(name = "ag", required = true) String assetGroup); @RequestMapping(path = "/v1/patching/topnoncompliantexecs", method = RequestMethod.GET) ResponseEntity<Object> getTopNonCompliantExecs(@RequestParam(name = "ag", required = true) String assetGroup); @RequestMapping(path = "/v1/patching/detail", method = RequestMethod.POST) ResponseEntity<Object> getPatchingDetails(@RequestBody(required = true) Request request); @RequestMapping(path = "/v1/patching/progress", method = RequestMethod.POST) ResponseEntity<Object> getPatchingProgress(@RequestBody(required = true) PatchingRequest request); @RequestMapping(path = "/v1/patching/quarters", method = RequestMethod.POST) ResponseEntity<Object> getQuartersWithPatchingData(String assetGroup); @RequestMapping(path = "/v1/patching/rating", method = RequestMethod.GET) ResponseEntity<Object> getPatchingDataForAgForQuarter(String ag, int quarter, int year);  }### Answer:
@Test public void getPatchingProgressTest() throws Exception { when(patchingService.getPatchingProgress(anyString(),anyInt(),anyInt())).thenReturn(CommonTestUtil.getMapObject()); assertThat(patchingController.getPatchingProgress(CommonTestUtil.getPatchingRequest()), is(notNullValue())); assertThat(patchingController.getPatchingProgress(CommonTestUtil.getPatchingRequestEmpty()), is(notNullValue())); assertThat(patchingController.getPatchingProgress(CommonTestUtil.getPatchingRequestYearAndQuarterEmpty()), is(notNullValue())); assertThat(patchingController.getPatchingProgress(CommonTestUtil.getPatchingRequestMoreYear()), is(notNullValue())); when(patchingService.getPatchingProgress(anyString(),anyInt(),anyInt())).thenThrow(new ServiceException()); when(complianceService.formatException(anyObject())).thenReturn(ResponseUtils.buildFailureResponse(new ServiceException())); ResponseEntity<Object> responseObj = patchingController.getPatchingProgress(CommonTestUtil.getPatchingRequest()); assertTrue(responseObj.getStatusCode() == HttpStatus.EXPECTATION_FAILED); }