### Question:
FilterController implements Constants { @RequestMapping(path = "/v1/filters/policies", method = RequestMethod.GET) public ResponseEntity<Object> getPolicies(@RequestParam("ag") String assetGroup, @RequestParam("domain") String domain) { if (Strings.isNullOrEmpty(assetGroup)) { return ResponseUtils.buildFailureResponse(new ServiceException(ASSET_MANDATORY)); } ResponseData response = null; try { response = new ResponseData(filterService.getPolicies(assetGroup, domain)); } catch (ServiceException e) { return complianceService.formatException(e); } return ResponseUtils.buildSucessResponse(response); }  @RequestMapping(path = "/v1/filters", method = RequestMethod.GET) ResponseEntity<Object> getFilters(
            @ApiParam(value = "Provide filter 1-issue,2-vulnerability,3-asset,4-compliance", required = false) @RequestParam("filterId") int filterId,
            @RequestParam(name = "domain", required = false) String domain); @RequestMapping(path = "/v1/filters/policies", method = RequestMethod.GET) ResponseEntity<Object> getPolicies(@RequestParam("ag") String assetGroup,
            @RequestParam("domain") String domain); @RequestMapping(path = "/v1/filters/regions", method = RequestMethod.GET) ResponseEntity<Object> getRegions(@RequestParam("ag") String assetGroup); @RequestMapping(path = "/v1/filters/accounts", method = RequestMethod.GET) ResponseEntity<Object> getAccounts(@RequestParam("ag") String assetGroup); @RequestMapping(path = "/v1/filters/rules", method = RequestMethod.GET) ResponseEntity<Object> getRules(@RequestParam("ag") String assetGroup, @RequestParam("domain") String domain); @RequestMapping(path = "/v1/filters/application", method = RequestMethod.GET) ResponseEntity<Object> getListOfApplications(@RequestParam(name = "ag", required = true) String assetGroup,
            @RequestParam(name = "domain", required = false) String domain); @RequestMapping(path = "/v1/filters/environment", method = RequestMethod.GET) ResponseEntity<Object> getListOfEnvironments(@RequestParam(name = "ag", required = true) String assetGroup,
            @RequestParam(name = "application", required = false) String application,
            @RequestParam(name = "domain", required = false) String domain); @GetMapping(value = "/v1/filters/targettype") ResponseEntity<Object> getListOfTargetTypes(@RequestParam(name = "ag", required = true) String assetGroup,
            @RequestParam(name = "domain", required = false) String domain);  }### Answer:
@Test public void getPoliciesTest() throws Exception { when(filterService.getPolicies(anyString(),anyString())).thenReturn(CommonTestUtil.getListMapObject()); assertThat(filterController.getPolicies("ag","domain"), is(notNullValue())); assertThat(filterController.getPolicies("",""), is(notNullValue())); when(filterService.getPolicies(anyString(),anyString())).thenThrow(new ServiceException()); when(complianceService.formatException(anyObject())).thenReturn(ResponseUtils.buildFailureResponse(new ServiceException())); ResponseEntity<Object> responseObj = filterController.getPolicies("ag","domain"); assertTrue(responseObj.getStatusCode() == HttpStatus.EXPECTATION_FAILED); }