### Question:
RecommendationsController { @GetMapping(value = "/v1/recommendations/summary") public ResponseEntity<Object> getRecommendationSummary(@RequestParam(name = "ag", required = false) String assetGroup, @RequestParam(name = "application", required = false) String application, @RequestParam(name = "general", required = true) Boolean general) { if(!general && StringUtils.isBlank(assetGroup)) { return ResponseUtils.buildFailureResponse(new Exception(Constants.ASSET_MANDATORY)); } try { return ResponseUtils.buildSucessResponse(recommendationsService.getRecommendationSummary(assetGroup,application,general)); } catch (DataException e) { LOGGER.error("Error in getRecommendationSummary "+ 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);  }### Answer:
@Test public void getRecommendationSummaryTest() throws Exception { when(recommendationsService.getRecommendationSummary(anyString(),anyString(),anyBoolean())).thenReturn(new ArrayList<>()); ReflectionTestUtils.setField(recommendationsController, "recommendationsService", recommendationsService); assertTrue(recommendationsController.getRecommendationSummary("ag", null, false).getStatusCode() == HttpStatus.OK); assertTrue(recommendationsController.getRecommendationSummary(null, null, true).getStatusCode() == HttpStatus.OK); }
@Test public void getRecommendationSummaryTest_Exception() throws Exception { when(recommendationsService.getRecommendationSummary(anyString(),anyString(),anyBoolean())).thenThrow(new DataException()); ReflectionTestUtils.setField(recommendationsController, "recommendationsService", recommendationsService); assertTrue(recommendationsController.getRecommendationSummary("ag", null, false).getStatusCode() == HttpStatus.EXPECTATION_FAILED); assertTrue(recommendationsController.getRecommendationSummary(null, null, false).getStatusCode() == HttpStatus.EXPECTATION_FAILED); }