### Question:
ProjectionController implements Constants { @RequestMapping(path = "/v1/getprojection", method = RequestMethod.GET) public ResponseEntity<Object> getProjectionData( @RequestParam(name = "targettype", required = true) String targetType, @RequestParam(name = "year", required = true) int year, @RequestParam(name = "quarter", required = true) int quarter) { if (Strings.isNullOrEmpty(targetType) || year <= 0 || quarter <= 0) { return ResponseUtils.buildFailureResponse(new ServiceException("targetType/year/quarter is Mandatory")); } if (quarter > FOUR) { return ResponseUtils.buildFailureResponse(new ServiceException("Invalid quarter")); } ProjectionResponse response; try { response = projectionService.getProjection(targetType, year, quarter); } catch (ServiceException e) { LOGGER.error(e.toString()); return ResponseUtils.buildFailureResponse(e); } return ResponseUtils.buildSucessResponse(response); }  @RequestMapping(path = "/v1/getprojection", method = RequestMethod.GET) ResponseEntity<Object> getProjectionData(
            @RequestParam(name = "targettype", required = true) String targetType,
            @RequestParam(name = "year", required = true) int year,
            @RequestParam(name = "quarter", required = true) int quarter); @ApiOperation(httpMethod = "POST", value = "Save or Update Projection Details") @PostMapping(value = "/v1/updateprojection") ResponseEntity<Object> updateProjectionData(@RequestBody ProjectionRequest projectionRequest); @RequestMapping(path = "/v1/getPatchingAndProjectionProgress", method = RequestMethod.GET) ResponseEntity<Object> getPatchingAndProjectionProgress(
            @RequestParam(name = "ag", required = true) String assetGroup); @RequestMapping(path = "/v1/getPatchingProgressByDirector", method = RequestMethod.POST) ResponseEntity<Object> patchingProgressByDirector(@RequestBody(required = false) Request request); @RequestMapping(path = "/v1/getPatchingProgressByExecutiveSponsor", method = RequestMethod.POST) ResponseEntity<Object> patchingProgressByExecutiveSponser(@RequestBody(required = false) Request request);  }### Answer:
@Test public void getProjectionDataTest() throws Exception { when(projectionService.getProjection(anyString(),anyInt(),anyInt())).thenReturn(CommonTestUtil.getProjectionResponse()); assertThat(projectionController.getProjectionData("onpremserver",2018,2), is(notNullValue())); assertThat(projectionController.getProjectionData("",0,5), is(notNullValue())); when(projectionService.getProjection(anyString(),anyInt(),anyInt())).thenThrow(new ServiceException()); ResponseEntity<Object> responseObj = projectionController.getProjectionData("onpremserver",2018,2); assertTrue(responseObj.getStatusCode() == HttpStatus.EXPECTATION_FAILED); }
@Test public void getProjectionDataWithMoreQuarterNumberTest() throws Exception { when(projectionService.getProjection(anyString(),anyInt(),anyInt())).thenReturn(CommonTestUtil.getProjectionResponse()); assertThat(projectionController.getProjectionData("onpremserver",2018,5), is(notNullValue())); }