@Test public void getSummaryByApplicationTest() throws Exception { when(recommendationsService.getSummaryByApplication(anyString(),anyString())).thenReturn(new HashMap<>()); ReflectionTestUtils.setField(recommendationsController, "recommendationsService", recommendationsService); assertTrue(recommendationsController.getSummaryByApplication("ag", "app").getStatusCode() == HttpStatus.OK); when(recommendationsService.getSummaryByApplication(anyString(),anyString())).thenThrow(new DataException()); assertTrue(recommendationsController.getSummaryByApplication("ag", "app").getStatusCode() == HttpStatus.EXPECTATION_FAILED); }
@GetMapping(value = "/v1/recommendations/summaryByApplication") public ResponseEntity<Object> getSummaryByApplication(@RequestParam(name = "ag", required = true) String assetGroup, @RequestParam(name = "category", required = false) String category) { try { return ResponseUtils.buildSucessResponse(recommendationsService.getSummaryByApplication(assetGroup,category)); } catch (DataException e) { LOGGER.error("Error in getSummaryByApplication "+ e); return ResponseUtils.buildFailureResponse(e); } }
RecommendationsController { @GetMapping(value = "/v1/recommendations/summaryByApplication") public ResponseEntity<Object> getSummaryByApplication(@RequestParam(name = "ag", required = true) String assetGroup, @RequestParam(name = "category", required = false) String category) { try { return ResponseUtils.buildSucessResponse(recommendationsService.getSummaryByApplication(assetGroup,category)); } catch (DataException e) { LOGGER.error("Error in getSummaryByApplication "+ e); return ResponseUtils.buildFailureResponse(e); } } }
RecommendationsController { @GetMapping(value = "/v1/recommendations/summaryByApplication") public ResponseEntity<Object> getSummaryByApplication(@RequestParam(name = "ag", required = true) String assetGroup, @RequestParam(name = "category", required = false) String category) { try { return ResponseUtils.buildSucessResponse(recommendationsService.getSummaryByApplication(assetGroup,category)); } catch (DataException e) { LOGGER.error("Error in getSummaryByApplication "+ e); return ResponseUtils.buildFailureResponse(e); } }  }
RecommendationsController { @GetMapping(value = "/v1/recommendations/summaryByApplication") public ResponseEntity<Object> getSummaryByApplication(@RequestParam(name = "ag", required = true) String assetGroup, @RequestParam(name = "category", required = false) String category) { try { return ResponseUtils.buildSucessResponse(recommendationsService.getSummaryByApplication(assetGroup,category)); } catch (DataException e) { LOGGER.error("Error in getSummaryByApplication "+ e); return ResponseUtils.buildFailureResponse(e); } }  @GetMapping(value = "/v1/recommendations/summary") ResponseEntity<Object> getRecommendationSummary(@RequestParam(name = "ag", required = false) String assetGroup, 
    		@RequestParam(name = "application", required = false) String application, @RequestParam(name = "general", required = true) Boolean general); @GetMapping(value = "/v1/recommendations/summaryByApplication") ResponseEntity<Object> getSummaryByApplication(@RequestParam(name = "ag", required = true) String assetGroup, 
    		@RequestParam(name = "category", required = false) String category); @SuppressWarnings("unchecked") @PostMapping(value = "/v1/recommendations") ResponseEntity<Object> getRecommendations(@RequestBody(required = true) Request request); @SuppressWarnings("unchecked") @PostMapping(value = "/v1/recommendations/detail") ResponseEntity<Object> getRecommendationDetail(@RequestBody(required = true) Request request); @GetMapping(value = "/v1/recommendations/info") ResponseEntity<Object> getRecommendationInfo(@RequestParam(name = "recommendationId", required = true) String recommendationId); }
RecommendationsController { @GetMapping(value = "/v1/recommendations/summaryByApplication") public ResponseEntity<Object> getSummaryByApplication(@RequestParam(name = "ag", required = true) String assetGroup, @RequestParam(name = "category", required = false) String category) { try { return ResponseUtils.buildSucessResponse(recommendationsService.getSummaryByApplication(assetGroup,category)); } catch (DataException e) { LOGGER.error("Error in getSummaryByApplication "+ e); return ResponseUtils.buildFailureResponse(e); } }  @GetMapping(value = "/v1/recommendations/summary") ResponseEntity<Object> getRecommendationSummary(@RequestParam(name = "ag", required = false) String assetGroup, 
    		@RequestParam(name = "application", required = false) String application, @RequestParam(name = "general", required = true) Boolean general); @GetMapping(value = "/v1/recommendations/summaryByApplication") ResponseEntity<Object> getSummaryByApplication(@RequestParam(name = "ag", required = true) String assetGroup, 
    		@RequestParam(name = "category", required = false) String category); @SuppressWarnings("unchecked") @PostMapping(value = "/v1/recommendations") ResponseEntity<Object> getRecommendations(@RequestBody(required = true) Request request); @SuppressWarnings("unchecked") @PostMapping(value = "/v1/recommendations/detail") ResponseEntity<Object> getRecommendationDetail(@RequestBody(required = true) Request request); @GetMapping(value = "/v1/recommendations/info") ResponseEntity<Object> getRecommendationInfo(@RequestParam(name = "recommendationId", required = true) String recommendationId);  }