### Question:
TaggingController implements Constants { @RequestMapping(path = "/v1/tagging/taggingByApplication", method = RequestMethod.GET) public ResponseEntity<Object> taggingByApplication(@RequestParam("ag") String assetGroup, @RequestParam(name = "targetType", required = false) String targetType) { if (Strings.isNullOrEmpty(assetGroup)) { return ResponseUtils.buildFailureResponse(new Exception(ASSET_MANDATORY)); } TaggingResponse response = null; try { response = new TaggingResponse(taggingService.taggingByApplication(assetGroup, targetType)); } catch (ServiceException e) { return complianceService.formatException(e); } return ResponseUtils.buildSucessResponse(response); }  @RequestMapping(path = "/v1/tagging/summarybyapplication", method = RequestMethod.POST) @ResponseBody ResponseEntity<Object> getUntaggedAssetsByApp(@RequestBody(required = false) Request request); @RequestMapping(path = "/v1/tagging/compliance", method = RequestMethod.GET) ResponseEntity<Object> taggingSummary(@RequestParam("ag") String assetGroup); @RequestMapping(path = "/v1/tagging/summarybytargettype", method = RequestMethod.POST) @ResponseBody ResponseEntity<Object> untaggingByTargetTypes(@RequestBody UntaggedTargetTypeRequest request); @RequestMapping(path = "/v1/tagging/taggingByApplication", method = RequestMethod.GET) ResponseEntity<Object> taggingByApplication(@RequestParam("ag") String assetGroup,
            @RequestParam(name = "targetType", required = false) String targetType);  }### Answer:
@Test public void taggingByApplicationTest() throws Exception { when(taggingService.taggingByApplication(anyString(),anyString())).thenReturn(CommonTestUtil.getListMapLong()); assertThat(taggingController.taggingByApplication("ag","targetType"), is(notNullValue())); assertThat(taggingController.taggingByApplication("",""), is(notNullValue())); when(taggingService.taggingByApplication(anyString(),anyString())).thenThrow(new ServiceException()); when(complianceService.formatException(anyObject())).thenReturn(ResponseUtils.buildFailureResponse(new ServiceException())); ResponseEntity<Object> responseObj = taggingController.taggingByApplication("ag","targetType"); assertTrue(responseObj.getStatusCode() == HttpStatus.EXPECTATION_FAILED); }