@Test public void patchingProgressByExecutiveSponserTest() throws Exception { Request request = new Request(); Request request1 = new Request(); request.setAg("aws-all"); when(projectionService.patchProgByExSponsor(anyString())).thenReturn(CommonTestUtil.getPatchingProgressResponse()); assertThat(projectionController.patchingProgressByExecutiveSponser(request), is(notNullValue())); assertThat(projectionController.patchingProgressByExecutiveSponser(request1), is(notNullValue())); when(projectionService.patchProgByExSponsor(anyString())).thenThrow(new ServiceException()); ResponseEntity<Object> responseObj = projectionController.patchingProgressByExecutiveSponser(request); assertTrue(responseObj.getStatusCode() == HttpStatus.EXPECTATION_FAILED); }
@RequestMapping(path = "/v1/getPatchingProgressByExecutiveSponsor", method = RequestMethod.POST) public ResponseEntity<Object> patchingProgressByExecutiveSponser(@RequestBody(required = false) Request request) { String assetGroup = request.getAg(); if (Strings.isNullOrEmpty(assetGroup)) { return ResponseUtils.buildFailureResponse(new ServiceException(ASSET_MANDATORY)); } PatchingProgressResponse response; try { response = projectionService.patchProgByExSponsor(assetGroup); } catch (ServiceException e) { return ResponseUtils.buildFailureResponse(e); } return ResponseUtils.buildSucessResponse(response); }
ProjectionController implements Constants { @RequestMapping(path = "/v1/getPatchingProgressByExecutiveSponsor", method = RequestMethod.POST) public ResponseEntity<Object> patchingProgressByExecutiveSponser(@RequestBody(required = false) Request request) { String assetGroup = request.getAg(); if (Strings.isNullOrEmpty(assetGroup)) { return ResponseUtils.buildFailureResponse(new ServiceException(ASSET_MANDATORY)); } PatchingProgressResponse response; try { response = projectionService.patchProgByExSponsor(assetGroup); } catch (ServiceException e) { return ResponseUtils.buildFailureResponse(e); } return ResponseUtils.buildSucessResponse(response); } }
ProjectionController implements Constants { @RequestMapping(path = "/v1/getPatchingProgressByExecutiveSponsor", method = RequestMethod.POST) public ResponseEntity<Object> patchingProgressByExecutiveSponser(@RequestBody(required = false) Request request) { String assetGroup = request.getAg(); if (Strings.isNullOrEmpty(assetGroup)) { return ResponseUtils.buildFailureResponse(new ServiceException(ASSET_MANDATORY)); } PatchingProgressResponse response; try { response = projectionService.patchProgByExSponsor(assetGroup); } catch (ServiceException e) { return ResponseUtils.buildFailureResponse(e); } return ResponseUtils.buildSucessResponse(response); }  }
ProjectionController implements Constants { @RequestMapping(path = "/v1/getPatchingProgressByExecutiveSponsor", method = RequestMethod.POST) public ResponseEntity<Object> patchingProgressByExecutiveSponser(@RequestBody(required = false) Request request) { String assetGroup = request.getAg(); if (Strings.isNullOrEmpty(assetGroup)) { return ResponseUtils.buildFailureResponse(new ServiceException(ASSET_MANDATORY)); } PatchingProgressResponse response; try { response = projectionService.patchProgByExSponsor(assetGroup); } catch (ServiceException e) { 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); }
ProjectionController implements Constants { @RequestMapping(path = "/v1/getPatchingProgressByExecutiveSponsor", method = RequestMethod.POST) public ResponseEntity<Object> patchingProgressByExecutiveSponser(@RequestBody(required = false) Request request) { String assetGroup = request.getAg(); if (Strings.isNullOrEmpty(assetGroup)) { return ResponseUtils.buildFailureResponse(new ServiceException(ASSET_MANDATORY)); } PatchingProgressResponse response; try { response = projectionService.patchProgByExSponsor(assetGroup); } catch (ServiceException e) { 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);  }