@Test public void isShapeFileExist() throws Exception { when(boundaryService.checkTenantShapeFileExistOrNot(any(String.class))) .thenReturn(true); ResponseInfo responseInfo = ResponseInfo.builder().build(); when(responseInfoFactory.createResponseInfoFromRequestInfo(any(RequestInfo.class), any(Boolean.class))) .thenReturn(responseInfo); mockMvc.perform(post("/boundarys/isshapefileexist").param("tenantId", "default") .contentType(MediaType.APPLICATION_JSON_UTF8).content(getFileContents("requestInfoWrapper.json"))) .andExpect(status().isOk()).andExpect(content().json(getFileContents("tenantShapeFileExistOrNotResponse.json"))); }
@PostMapping("/isshapefileexist") @ResponseBody public ResponseEntity<?> isShapeFileExist(@RequestParam(value = "tenantId", required = true) String tenantId, @RequestBody @Valid final RequestInfoWrapper requestInfoWrapper) { final RequestInfo requestInfo = requestInfoWrapper.getRequestInfo(); boolean exist = false; try { if (tenantId != null && !tenantId.isEmpty()) { exist = boundaryService.checkTenantShapeFileExistOrNot(tenantId); return getSuccessResponse(requestInfo, exist); } return getFailureResponse(requestInfo); } catch (final Exception e) { return new ResponseEntity<String>("error in request", HttpStatus.BAD_REQUEST); } }
BoundaryController { @PostMapping("/isshapefileexist") @ResponseBody public ResponseEntity<?> isShapeFileExist(@RequestParam(value = "tenantId", required = true) String tenantId, @RequestBody @Valid final RequestInfoWrapper requestInfoWrapper) { final RequestInfo requestInfo = requestInfoWrapper.getRequestInfo(); boolean exist = false; try { if (tenantId != null && !tenantId.isEmpty()) { exist = boundaryService.checkTenantShapeFileExistOrNot(tenantId); return getSuccessResponse(requestInfo, exist); } return getFailureResponse(requestInfo); } catch (final Exception e) { return new ResponseEntity<String>("error in request", HttpStatus.BAD_REQUEST); } } }
BoundaryController { @PostMapping("/isshapefileexist") @ResponseBody public ResponseEntity<?> isShapeFileExist(@RequestParam(value = "tenantId", required = true) String tenantId, @RequestBody @Valid final RequestInfoWrapper requestInfoWrapper) { final RequestInfo requestInfo = requestInfoWrapper.getRequestInfo(); boolean exist = false; try { if (tenantId != null && !tenantId.isEmpty()) { exist = boundaryService.checkTenantShapeFileExistOrNot(tenantId); return getSuccessResponse(requestInfo, exist); } return getFailureResponse(requestInfo); } catch (final Exception e) { return new ResponseEntity<String>("error in request", HttpStatus.BAD_REQUEST); } }  }
BoundaryController { @PostMapping("/isshapefileexist") @ResponseBody public ResponseEntity<?> isShapeFileExist(@RequestParam(value = "tenantId", required = true) String tenantId, @RequestBody @Valid final RequestInfoWrapper requestInfoWrapper) { final RequestInfo requestInfo = requestInfoWrapper.getRequestInfo(); boolean exist = false; try { if (tenantId != null && !tenantId.isEmpty()) { exist = boundaryService.checkTenantShapeFileExistOrNot(tenantId); return getSuccessResponse(requestInfo, exist); } return getFailureResponse(requestInfo); } catch (final Exception e) { return new ResponseEntity<String>("error in request", HttpStatus.BAD_REQUEST); } }  @PostMapping @ResponseBody ResponseEntity<?> create(@RequestBody @Valid BoundaryRequest boundaryRequest, BindingResult errors); @PutMapping(value = "/{code}") @ResponseBody ResponseEntity<?> update(@RequestBody @Valid BoundaryRequest boundaryRequest, BindingResult errors,
			@PathVariable String code, @RequestParam(value = "tenantId", required = true) String tenantId); @GetMapping @ResponseBody ResponseEntity<?> search(@Valid @RequestParam(value = "boundary", required = false) Long boundary,
			@RequestParam(value = "tenantId", required = false) String tenantId,
			@ModelAttribute BoundaryRequest boundaryRequest, BindingResult errors); @GetMapping("/getLocationByLocationName") @ResponseBody ResponseEntity<?> getLocation(@RequestParam(value = "tenantId", required = true) String tenantId,
			@RequestParam("locationName") final String locationName); @PostMapping(value = "/childLocationsByBoundaryId") @ResponseBody ResponseEntity<?> getChildLocationsByBoundaryId(
			@RequestParam(value = "tenantId", required = true) String tenantId,
			@RequestParam(value = "boundaryId", required = true) final String boundaryId); @PostMapping(value = "/getByBoundaryType") @ResponseBody ResponseEntity<?> getBoundaryByBoundaryTypeId(
			@RequestParam(value = "boundaryTypeId", required = true) final String boundaryTypeId,
			@RequestParam(value = "tenantId", required = true) final String tenantId); @PostMapping(value = "/boundariesByBndryTypeNameAndHierarchyTypeName") @ResponseBody ResponseEntity<?> getBoundariesByBndryTypeNameAndHierarchyTypeName(
			@RequestParam(value = "tenantId", required = true) String tenantId,
			@RequestParam(value = "boundaryTypeName", required = true) final String boundaryTypeName,
			@RequestParam(value = "hierarchyTypeName", required = true) final String hierarchyTypeName); @PostMapping("/isshapefileexist") @ResponseBody ResponseEntity<?> isShapeFileExist(@RequestParam(value = "tenantId", required = true) String tenantId,
			@RequestBody @Valid final RequestInfoWrapper requestInfoWrapper); @GetMapping("/getshapefile") @ResponseBody ResponseEntity<Resource> fetchShapeFileForTenant(@RequestParam(value = "tenantid", required = true, defaultValue = "default") final String tenantId); @PostMapping(value = "/_search") @ResponseBody ResponseEntity<?> boundarySearch(@RequestParam(value = "tenantId", required = true) String tenantId,
			@RequestParam(value = "boundaryIds", required = false) final List<Long> boundaryIds,
			@RequestParam(value = "boundaryNum", required = false) final List<Long> boundaryNum,
			@RequestParam(value = "boundaryType", required = false) final String boundaryType,
			@RequestParam(value = "hierarchyType", required = false) final String hierarchyType,
			@RequestParam(value = "codes", required = false) final List<String> codes); }
BoundaryController { @PostMapping("/isshapefileexist") @ResponseBody public ResponseEntity<?> isShapeFileExist(@RequestParam(value = "tenantId", required = true) String tenantId, @RequestBody @Valid final RequestInfoWrapper requestInfoWrapper) { final RequestInfo requestInfo = requestInfoWrapper.getRequestInfo(); boolean exist = false; try { if (tenantId != null && !tenantId.isEmpty()) { exist = boundaryService.checkTenantShapeFileExistOrNot(tenantId); return getSuccessResponse(requestInfo, exist); } return getFailureResponse(requestInfo); } catch (final Exception e) { return new ResponseEntity<String>("error in request", HttpStatus.BAD_REQUEST); } }  @PostMapping @ResponseBody ResponseEntity<?> create(@RequestBody @Valid BoundaryRequest boundaryRequest, BindingResult errors); @PutMapping(value = "/{code}") @ResponseBody ResponseEntity<?> update(@RequestBody @Valid BoundaryRequest boundaryRequest, BindingResult errors,
			@PathVariable String code, @RequestParam(value = "tenantId", required = true) String tenantId); @GetMapping @ResponseBody ResponseEntity<?> search(@Valid @RequestParam(value = "boundary", required = false) Long boundary,
			@RequestParam(value = "tenantId", required = false) String tenantId,
			@ModelAttribute BoundaryRequest boundaryRequest, BindingResult errors); @GetMapping("/getLocationByLocationName") @ResponseBody ResponseEntity<?> getLocation(@RequestParam(value = "tenantId", required = true) String tenantId,
			@RequestParam("locationName") final String locationName); @PostMapping(value = "/childLocationsByBoundaryId") @ResponseBody ResponseEntity<?> getChildLocationsByBoundaryId(
			@RequestParam(value = "tenantId", required = true) String tenantId,
			@RequestParam(value = "boundaryId", required = true) final String boundaryId); @PostMapping(value = "/getByBoundaryType") @ResponseBody ResponseEntity<?> getBoundaryByBoundaryTypeId(
			@RequestParam(value = "boundaryTypeId", required = true) final String boundaryTypeId,
			@RequestParam(value = "tenantId", required = true) final String tenantId); @PostMapping(value = "/boundariesByBndryTypeNameAndHierarchyTypeName") @ResponseBody ResponseEntity<?> getBoundariesByBndryTypeNameAndHierarchyTypeName(
			@RequestParam(value = "tenantId", required = true) String tenantId,
			@RequestParam(value = "boundaryTypeName", required = true) final String boundaryTypeName,
			@RequestParam(value = "hierarchyTypeName", required = true) final String hierarchyTypeName); @PostMapping("/isshapefileexist") @ResponseBody ResponseEntity<?> isShapeFileExist(@RequestParam(value = "tenantId", required = true) String tenantId,
			@RequestBody @Valid final RequestInfoWrapper requestInfoWrapper); @GetMapping("/getshapefile") @ResponseBody ResponseEntity<Resource> fetchShapeFileForTenant(@RequestParam(value = "tenantid", required = true, defaultValue = "default") final String tenantId); @PostMapping(value = "/_search") @ResponseBody ResponseEntity<?> boundarySearch(@RequestParam(value = "tenantId", required = true) String tenantId,
			@RequestParam(value = "boundaryIds", required = false) final List<Long> boundaryIds,
			@RequestParam(value = "boundaryNum", required = false) final List<Long> boundaryNum,
			@RequestParam(value = "boundaryType", required = false) final String boundaryType,
			@RequestParam(value = "hierarchyType", required = false) final String hierarchyType,
			@RequestParam(value = "codes", required = false) final List<String> codes); static final Logger LOGGER; }