@Test public void test_search() throws IOException, Exception { final Pagination<BudgetDetail> page = new Pagination<>(); page.setTotalPages(1); page.setTotalResults(1); page.setCurrentPage(0); page.setPagedData(getBudgetDetails()); page.getPagedData().get(0).setId("1"); when(budgetDetailService.search(any(BudgetDetailSearch.class))).thenReturn(page); mockMvc.perform(post("/budgetdetails/_search").content(resources.getRequestInfo()) .contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().is(200)) .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect( content().json(resources.readResponse("budgetdetail/budgetdetail_search_valid_response.json"))); }
@PostMapping("/_search") @ResponseBody @ResponseStatus(HttpStatus.OK) public BudgetDetailResponse search(@ModelAttribute final BudgetDetailSearchContract budgetDetailSearchContract, @RequestBody final RequestInfo requestInfo, final BindingResult errors) { final BudgetDetailMapper mapper = new BudgetDetailMapper(); final BudgetDetailSearch domain = mapper.toSearchDomain(budgetDetailSearchContract); BudgetDetailContract contract = null; final List<BudgetDetailContract> budgetDetailContracts = new ArrayList<BudgetDetailContract>(); final Pagination<BudgetDetail> budgetdetails = budgetDetailService.search(domain); for (final BudgetDetail budgetDetail : budgetdetails.getPagedData()) { contract = mapper.toContract(budgetDetail); budgetDetailContracts.add(contract); } final BudgetDetailResponse response = new BudgetDetailResponse(); response.setBudgetDetails(budgetDetailContracts); response.setPage(new PaginationContract(budgetdetails)); response.setResponseInfo(getResponseInfo(requestInfo)); return response; }
BudgetDetailController { @PostMapping("/_search") @ResponseBody @ResponseStatus(HttpStatus.OK) public BudgetDetailResponse search(@ModelAttribute final BudgetDetailSearchContract budgetDetailSearchContract, @RequestBody final RequestInfo requestInfo, final BindingResult errors) { final BudgetDetailMapper mapper = new BudgetDetailMapper(); final BudgetDetailSearch domain = mapper.toSearchDomain(budgetDetailSearchContract); BudgetDetailContract contract = null; final List<BudgetDetailContract> budgetDetailContracts = new ArrayList<BudgetDetailContract>(); final Pagination<BudgetDetail> budgetdetails = budgetDetailService.search(domain); for (final BudgetDetail budgetDetail : budgetdetails.getPagedData()) { contract = mapper.toContract(budgetDetail); budgetDetailContracts.add(contract); } final BudgetDetailResponse response = new BudgetDetailResponse(); response.setBudgetDetails(budgetDetailContracts); response.setPage(new PaginationContract(budgetdetails)); response.setResponseInfo(getResponseInfo(requestInfo)); return response; } }
BudgetDetailController { @PostMapping("/_search") @ResponseBody @ResponseStatus(HttpStatus.OK) public BudgetDetailResponse search(@ModelAttribute final BudgetDetailSearchContract budgetDetailSearchContract, @RequestBody final RequestInfo requestInfo, final BindingResult errors) { final BudgetDetailMapper mapper = new BudgetDetailMapper(); final BudgetDetailSearch domain = mapper.toSearchDomain(budgetDetailSearchContract); BudgetDetailContract contract = null; final List<BudgetDetailContract> budgetDetailContracts = new ArrayList<BudgetDetailContract>(); final Pagination<BudgetDetail> budgetdetails = budgetDetailService.search(domain); for (final BudgetDetail budgetDetail : budgetdetails.getPagedData()) { contract = mapper.toContract(budgetDetail); budgetDetailContracts.add(contract); } final BudgetDetailResponse response = new BudgetDetailResponse(); response.setBudgetDetails(budgetDetailContracts); response.setPage(new PaginationContract(budgetdetails)); response.setResponseInfo(getResponseInfo(requestInfo)); return response; }  }
BudgetDetailController { @PostMapping("/_search") @ResponseBody @ResponseStatus(HttpStatus.OK) public BudgetDetailResponse search(@ModelAttribute final BudgetDetailSearchContract budgetDetailSearchContract, @RequestBody final RequestInfo requestInfo, final BindingResult errors) { final BudgetDetailMapper mapper = new BudgetDetailMapper(); final BudgetDetailSearch domain = mapper.toSearchDomain(budgetDetailSearchContract); BudgetDetailContract contract = null; final List<BudgetDetailContract> budgetDetailContracts = new ArrayList<BudgetDetailContract>(); final Pagination<BudgetDetail> budgetdetails = budgetDetailService.search(domain); for (final BudgetDetail budgetDetail : budgetdetails.getPagedData()) { contract = mapper.toContract(budgetDetail); budgetDetailContracts.add(contract); } final BudgetDetailResponse response = new BudgetDetailResponse(); response.setBudgetDetails(budgetDetailContracts); response.setPage(new PaginationContract(budgetdetails)); response.setResponseInfo(getResponseInfo(requestInfo)); return response; }  @PostMapping("/_create") @ResponseStatus(HttpStatus.CREATED) BudgetDetailResponse create(@RequestBody final BudgetDetailRequest budgetDetailRequest, final BindingResult errors); @PostMapping("/_update") @ResponseStatus(HttpStatus.CREATED) BudgetDetailResponse update(@RequestBody @Valid final BudgetDetailRequest budgetDetailRequest,
            final BindingResult errors); @PostMapping("/_delete") @ResponseStatus(HttpStatus.CREATED) BudgetDetailResponse delete(@RequestBody @Valid final BudgetDetailRequest budgetDetailRequest,
            final BindingResult errors); @PostMapping("/_search") @ResponseBody @ResponseStatus(HttpStatus.OK) BudgetDetailResponse search(@ModelAttribute final BudgetDetailSearchContract budgetDetailSearchContract,
            @RequestBody final RequestInfo requestInfo, final BindingResult errors); }
BudgetDetailController { @PostMapping("/_search") @ResponseBody @ResponseStatus(HttpStatus.OK) public BudgetDetailResponse search(@ModelAttribute final BudgetDetailSearchContract budgetDetailSearchContract, @RequestBody final RequestInfo requestInfo, final BindingResult errors) { final BudgetDetailMapper mapper = new BudgetDetailMapper(); final BudgetDetailSearch domain = mapper.toSearchDomain(budgetDetailSearchContract); BudgetDetailContract contract = null; final List<BudgetDetailContract> budgetDetailContracts = new ArrayList<BudgetDetailContract>(); final Pagination<BudgetDetail> budgetdetails = budgetDetailService.search(domain); for (final BudgetDetail budgetDetail : budgetdetails.getPagedData()) { contract = mapper.toContract(budgetDetail); budgetDetailContracts.add(contract); } final BudgetDetailResponse response = new BudgetDetailResponse(); response.setBudgetDetails(budgetDetailContracts); response.setPage(new PaginationContract(budgetdetails)); response.setResponseInfo(getResponseInfo(requestInfo)); return response; }  @PostMapping("/_create") @ResponseStatus(HttpStatus.CREATED) BudgetDetailResponse create(@RequestBody final BudgetDetailRequest budgetDetailRequest, final BindingResult errors); @PostMapping("/_update") @ResponseStatus(HttpStatus.CREATED) BudgetDetailResponse update(@RequestBody @Valid final BudgetDetailRequest budgetDetailRequest,
            final BindingResult errors); @PostMapping("/_delete") @ResponseStatus(HttpStatus.CREATED) BudgetDetailResponse delete(@RequestBody @Valid final BudgetDetailRequest budgetDetailRequest,
            final BindingResult errors); @PostMapping("/_search") @ResponseBody @ResponseStatus(HttpStatus.OK) BudgetDetailResponse search(@ModelAttribute final BudgetDetailSearchContract budgetDetailSearchContract,
            @RequestBody final RequestInfo requestInfo, final BindingResult errors); static final String ACTION_CREATE; static final String ACTION_UPDATE; static final String ACTION_DELETE; static final String PLACEHOLDER; }