### Question:
AssetCountController { @GetMapping(value = "/v1/count") public ResponseEntity<Object> geAssetCount(@RequestParam(name = "ag", required = true) String assetGroup, @RequestParam(name = "type", required = false) String type, @RequestParam(name = "domain", required = false) String domain, @RequestParam(name = "application", required = false) String application, @RequestParam(name = "provider", required = false) String provider) { if (type == null) { type = "all"; } List<Map<String, Object>> countMap = assetService.getAssetCountAndEnvDistributionByAssetGroup(assetGroup, type, domain, application, provider); LongSummaryStatistics totalCount = countMap.stream().collect(Collectors.summarizingLong(map -> (Long) map.get(Constants.COUNT))); Map<String, Object> response = new HashMap<>(); response.put("ag", assetGroup); response.put(AssetConstants.ASSET_COUNT, countMap); response.put(AssetConstants.ASSET_TYPE, totalCount.getCount()); response.put(AssetConstants.TOTAL_ASSETS, totalCount.getSum()); return ResponseUtils.buildSucessResponse(response); }  @GetMapping(value = "/v1/count") ResponseEntity<Object> geAssetCount(@RequestParam(name = "ag", required = true) String assetGroup,
            @RequestParam(name = "type", required = false) String type,
            @RequestParam(name = "domain", required = false) String domain,
            @RequestParam(name = "application", required = false) String application,
            @RequestParam(name = "provider", required = false) String provider); @GetMapping(value = "/v1/count/byapplication") ResponseEntity<Object> geAssetCountByTypeAndApplication(
            @RequestParam(name = "ag", required = true) String assetGroup,
            @RequestParam(name = "type", required = true) String type); @GetMapping(value = "/v1/count/byenvironment") ResponseEntity<Object> geAssetCountByTypeEnvironment(
            @RequestParam(name = "ag", required = true) String assetGroup,
            @RequestParam(name = "application", required = false) String application,
            @RequestParam(name = "type", required = true) String type);  }### Answer:
@Test public void testgeAssetCount() throws Exception { List<Map<String, Object>> tTypeList = new ArrayList<>(); when(service.getAssetCountByAssetGroup(anyObject(), anyObject(), anyObject(), anyObject(), anyObject())).thenReturn(tTypeList); ReflectionTestUtils.setField(controller, "assetService", service); ResponseEntity<Object> responseObj3 = controller.geAssetCount("ag", "type", "domain", null, null); assertTrue(responseObj3.getStatusCode() == HttpStatus.EXPECTATION_FAILED); Map<String, Object> tTypeMap = new HashMap<>(); tTypeMap.put("count", "100"); tTypeMap.put("type", "ec2"); tTypeList.add(tTypeMap); when(service.getAssetCountByAssetGroup(anyObject(), anyObject(), anyObject(), anyObject(), anyObject())).thenReturn(tTypeList); ReflectionTestUtils.setField(controller, "assetService", service); ResponseEntity<Object> responseObj = controller.geAssetCount("ag", "type", "domain", null, null); assertTrue(responseObj.getStatusCode() == HttpStatus.OK); assertTrue(((Map<String, Object>) responseObj.getBody()).get("data") != null); ResponseEntity<Object> responseObj2 = controller.geAssetCount("ag", null, "domain", null, null); assertTrue(responseObj2.getStatusCode() == HttpStatus.OK); }