@SuppressWarnings("unchecked") @Test public void test_should_search_asset_current_value() throws IOException, Exception { final List<AssetCurrentValue> assetCurrentValues = new ArrayList<>(); assetCurrentValues.add(getAssetCurrentValue()); final AssetCurrentValueResponse assetCurrentValueResponse = new AssetCurrentValueResponse(); final ResponseInfo responseInfo = getResponseInfo(); assetCurrentValueResponse.setResponseInfo(responseInfo); assetCurrentValueResponse.setAssetCurrentValues(assetCurrentValues); when(currentValueService.getCurrentValues(any(Set.class), any(String.class), any(RequestInfo.class))) .thenReturn(assetCurrentValueResponse); mockMvc.perform(post("/assets/currentvalue/_search").contentType(MediaType.APPLICATION_JSON) .param("tenantId", "ap.kurnool").param("assetIds", "298") .content(getFileContents("requestinfowrapper.json"))).andExpect(status().isOk()) .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) .andExpect(content().json(getFileContents("currentvalue/currentvaluesearchresponse.json"))); }
@PostMapping("currentvalue/_search") @ResponseBody public ResponseEntity<?> getAssetCurrentValue( @RequestParam(name = "assetIds", required = true) final Set<Long> assetIds, @RequestParam(name = "tenantId", required = true) final String tenantId, @RequestBody @Valid final RequestInfoWrapper requestInfoWrapper, final BindingResult bindingResult) { log.debug("getAssetCurrentValue assetId:" + assetIds + ",tenantId:" + tenantId); if (bindingResult.hasErrors()) { final ErrorResponse errorResponse = assetCommonService.populateErrors(bindingResult); return new ResponseEntity<>(errorResponse, HttpStatus.BAD_REQUEST); } final AssetCurrentValueResponse assetCurrentValueResponse = currentValueService.getCurrentValues(assetIds, tenantId, requestInfoWrapper.getRequestInfo()); log.debug("getAssetCurrentValue assetCurrentValueResponse:" + assetCurrentValueResponse); return new ResponseEntity<>(assetCurrentValueResponse, HttpStatus.OK); }
AssetController { @PostMapping("currentvalue/_search") @ResponseBody public ResponseEntity<?> getAssetCurrentValue( @RequestParam(name = "assetIds", required = true) final Set<Long> assetIds, @RequestParam(name = "tenantId", required = true) final String tenantId, @RequestBody @Valid final RequestInfoWrapper requestInfoWrapper, final BindingResult bindingResult) { log.debug("getAssetCurrentValue assetId:" + assetIds + ",tenantId:" + tenantId); if (bindingResult.hasErrors()) { final ErrorResponse errorResponse = assetCommonService.populateErrors(bindingResult); return new ResponseEntity<>(errorResponse, HttpStatus.BAD_REQUEST); } final AssetCurrentValueResponse assetCurrentValueResponse = currentValueService.getCurrentValues(assetIds, tenantId, requestInfoWrapper.getRequestInfo()); log.debug("getAssetCurrentValue assetCurrentValueResponse:" + assetCurrentValueResponse); return new ResponseEntity<>(assetCurrentValueResponse, HttpStatus.OK); } }
AssetController { @PostMapping("currentvalue/_search") @ResponseBody public ResponseEntity<?> getAssetCurrentValue( @RequestParam(name = "assetIds", required = true) final Set<Long> assetIds, @RequestParam(name = "tenantId", required = true) final String tenantId, @RequestBody @Valid final RequestInfoWrapper requestInfoWrapper, final BindingResult bindingResult) { log.debug("getAssetCurrentValue assetId:" + assetIds + ",tenantId:" + tenantId); if (bindingResult.hasErrors()) { final ErrorResponse errorResponse = assetCommonService.populateErrors(bindingResult); return new ResponseEntity<>(errorResponse, HttpStatus.BAD_REQUEST); } final AssetCurrentValueResponse assetCurrentValueResponse = currentValueService.getCurrentValues(assetIds, tenantId, requestInfoWrapper.getRequestInfo()); log.debug("getAssetCurrentValue assetCurrentValueResponse:" + assetCurrentValueResponse); return new ResponseEntity<>(assetCurrentValueResponse, HttpStatus.OK); }  }
AssetController { @PostMapping("currentvalue/_search") @ResponseBody public ResponseEntity<?> getAssetCurrentValue( @RequestParam(name = "assetIds", required = true) final Set<Long> assetIds, @RequestParam(name = "tenantId", required = true) final String tenantId, @RequestBody @Valid final RequestInfoWrapper requestInfoWrapper, final BindingResult bindingResult) { log.debug("getAssetCurrentValue assetId:" + assetIds + ",tenantId:" + tenantId); if (bindingResult.hasErrors()) { final ErrorResponse errorResponse = assetCommonService.populateErrors(bindingResult); return new ResponseEntity<>(errorResponse, HttpStatus.BAD_REQUEST); } final AssetCurrentValueResponse assetCurrentValueResponse = currentValueService.getCurrentValues(assetIds, tenantId, requestInfoWrapper.getRequestInfo()); log.debug("getAssetCurrentValue assetCurrentValueResponse:" + assetCurrentValueResponse); return new ResponseEntity<>(assetCurrentValueResponse, HttpStatus.OK); }  @PostMapping("_search") @ResponseBody ResponseEntity<?> search(@RequestBody @Valid final RequestInfoWrapper requestInfoWrapper,
            @ModelAttribute @Valid final AssetCriteria assetCriteria, final BindingResult bindingResult); @PostMapping("_paginatedsearch") @ResponseBody ResponseEntity<?> paginatedSearch(@ModelAttribute @Valid final AssetCriteria assetCriteria,
            @RequestBody @Valid final RequestInfoWrapper requestInfoWrapper,
            final BindingResult bindingResult); @PostMapping("_create") @ResponseBody ResponseEntity<?> create(@RequestBody @Valid final AssetRequest assetRequest,
            final BindingResult bindingResult); @PostMapping("_update") @ResponseBody ResponseEntity<?> update(@RequestBody final AssetRequest assetRequest, final BindingResult bindingResult); @PostMapping("revaluation/_create") @ResponseBody ResponseEntity<?> revaluate(@RequestBody @Valid final RevaluationRequest revaluationRequest,
            final BindingResult bindingResult, @RequestHeader final HttpHeaders headers); @PostMapping("revaluation/_search") @ResponseBody ResponseEntity<?> revaluateSearch(@RequestBody @Valid final RequestInfoWrapper requestInfoWrapper,
            @ModelAttribute @Valid final RevaluationCriteria revaluationCriteria, final BindingResult bindingResult); @PostMapping("dispose/_create") @ResponseBody ResponseEntity<?> dispose(@RequestBody @Valid final DisposalRequest disposalRequest,
            final BindingResult bindingResult, @RequestHeader final HttpHeaders headers); @PostMapping("dispose/_search") @ResponseBody ResponseEntity<?> disposalSearch(@RequestBody @Valid final RequestInfoWrapper requestInfoWrapper,
            @ModelAttribute @Valid final DisposalCriteria disposalCriteria, final BindingResult bindingResult); @PostMapping("currentvalue/_search") @ResponseBody ResponseEntity<?> getAssetCurrentValue(
            @RequestParam(name = "assetIds", required = true) final Set<Long> assetIds,
            @RequestParam(name = "tenantId", required = true) final String tenantId,
            @RequestBody @Valid final RequestInfoWrapper requestInfoWrapper, final BindingResult bindingResult); @PostMapping("currentvalue/_create") @ResponseBody ResponseEntity<?> saveCurrentValue(
            @RequestBody @Valid final AssetCurrentValueRequest assetCurrentValueRequest,
            final BindingResult bindingResult); @PostMapping("depreciations/_create") @ResponseBody ResponseEntity<?> saveDepreciation(@RequestBody @Valid final DepreciationRequest depreciationRequest,
            final BindingResult bindingResult, @RequestHeader final HttpHeaders headers); @PostMapping("depreciations/_search") @ResponseBody ResponseEntity<?> depreciationReport(@RequestBody @Valid final RequestInfoWrapper requestInfoWrapper,
            @ModelAttribute @Valid final DepreciationReportCriteria depreciationReportCriteria,
            final BindingResult bindingResult); ResponseEntity<?> getDisposalResponse(final List<Disposal> disposals, final RequestInfo requestInfo); ResponseEntity<?> getDepreciationResponse(final Depreciation depreciations, final RequestInfo requestInfo); ResponseEntity<?> getPaginatedSuccessResponse(final Map<String, Object> requestMap, final RequestInfo requestInfo); }
AssetController { @PostMapping("currentvalue/_search") @ResponseBody public ResponseEntity<?> getAssetCurrentValue( @RequestParam(name = "assetIds", required = true) final Set<Long> assetIds, @RequestParam(name = "tenantId", required = true) final String tenantId, @RequestBody @Valid final RequestInfoWrapper requestInfoWrapper, final BindingResult bindingResult) { log.debug("getAssetCurrentValue assetId:" + assetIds + ",tenantId:" + tenantId); if (bindingResult.hasErrors()) { final ErrorResponse errorResponse = assetCommonService.populateErrors(bindingResult); return new ResponseEntity<>(errorResponse, HttpStatus.BAD_REQUEST); } final AssetCurrentValueResponse assetCurrentValueResponse = currentValueService.getCurrentValues(assetIds, tenantId, requestInfoWrapper.getRequestInfo()); log.debug("getAssetCurrentValue assetCurrentValueResponse:" + assetCurrentValueResponse); return new ResponseEntity<>(assetCurrentValueResponse, HttpStatus.OK); }  @PostMapping("_search") @ResponseBody ResponseEntity<?> search(@RequestBody @Valid final RequestInfoWrapper requestInfoWrapper,
            @ModelAttribute @Valid final AssetCriteria assetCriteria, final BindingResult bindingResult); @PostMapping("_paginatedsearch") @ResponseBody ResponseEntity<?> paginatedSearch(@ModelAttribute @Valid final AssetCriteria assetCriteria,
            @RequestBody @Valid final RequestInfoWrapper requestInfoWrapper,
            final BindingResult bindingResult); @PostMapping("_create") @ResponseBody ResponseEntity<?> create(@RequestBody @Valid final AssetRequest assetRequest,
            final BindingResult bindingResult); @PostMapping("_update") @ResponseBody ResponseEntity<?> update(@RequestBody final AssetRequest assetRequest, final BindingResult bindingResult); @PostMapping("revaluation/_create") @ResponseBody ResponseEntity<?> revaluate(@RequestBody @Valid final RevaluationRequest revaluationRequest,
            final BindingResult bindingResult, @RequestHeader final HttpHeaders headers); @PostMapping("revaluation/_search") @ResponseBody ResponseEntity<?> revaluateSearch(@RequestBody @Valid final RequestInfoWrapper requestInfoWrapper,
            @ModelAttribute @Valid final RevaluationCriteria revaluationCriteria, final BindingResult bindingResult); @PostMapping("dispose/_create") @ResponseBody ResponseEntity<?> dispose(@RequestBody @Valid final DisposalRequest disposalRequest,
            final BindingResult bindingResult, @RequestHeader final HttpHeaders headers); @PostMapping("dispose/_search") @ResponseBody ResponseEntity<?> disposalSearch(@RequestBody @Valid final RequestInfoWrapper requestInfoWrapper,
            @ModelAttribute @Valid final DisposalCriteria disposalCriteria, final BindingResult bindingResult); @PostMapping("currentvalue/_search") @ResponseBody ResponseEntity<?> getAssetCurrentValue(
            @RequestParam(name = "assetIds", required = true) final Set<Long> assetIds,
            @RequestParam(name = "tenantId", required = true) final String tenantId,
            @RequestBody @Valid final RequestInfoWrapper requestInfoWrapper, final BindingResult bindingResult); @PostMapping("currentvalue/_create") @ResponseBody ResponseEntity<?> saveCurrentValue(
            @RequestBody @Valid final AssetCurrentValueRequest assetCurrentValueRequest,
            final BindingResult bindingResult); @PostMapping("depreciations/_create") @ResponseBody ResponseEntity<?> saveDepreciation(@RequestBody @Valid final DepreciationRequest depreciationRequest,
            final BindingResult bindingResult, @RequestHeader final HttpHeaders headers); @PostMapping("depreciations/_search") @ResponseBody ResponseEntity<?> depreciationReport(@RequestBody @Valid final RequestInfoWrapper requestInfoWrapper,
            @ModelAttribute @Valid final DepreciationReportCriteria depreciationReportCriteria,
            final BindingResult bindingResult); ResponseEntity<?> getDisposalResponse(final List<Disposal> disposals, final RequestInfo requestInfo); ResponseEntity<?> getDepreciationResponse(final Depreciation depreciations, final RequestInfo requestInfo); ResponseEntity<?> getPaginatedSuccessResponse(final Map<String, Object> requestMap, final RequestInfo requestInfo);  }