@Test public void test_search() throws IOException, Exception { final Pagination<BudgetReAppropriation> page = new Pagination<>(); page.setTotalPages(1); page.setTotalResults(1); page.setCurrentPage(0); page.setPagedData(getBudgetReAppropriations()); page.getPagedData().get(0).setId("1"); when(budgetReAppropriationService.search(any(BudgetReAppropriationSearch.class))).thenReturn(page); mockMvc.perform(post("/budgetreappropriations/_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("budgetreappropriation/budgetreappropriation_search_valid_response.json"))); }
@PostMapping("/_search") @ResponseBody @ResponseStatus(HttpStatus.OK) public BudgetReAppropriationResponse search( @ModelAttribute final BudgetReAppropriationSearchContract budgetReAppropriationSearchContract, @RequestBody final RequestInfo requestInfo, final BindingResult errors) { final BudgetReAppropriationMapper mapper = new BudgetReAppropriationMapper(); final BudgetReAppropriationSearch domain = mapper.toSearchDomain(budgetReAppropriationSearchContract); BudgetReAppropriationContract contract = null; final List<BudgetReAppropriationContract> budgetReAppropriationContracts = new ArrayList<BudgetReAppropriationContract>(); final Pagination<BudgetReAppropriation> budgetreappropriations = budgetReAppropriationService.search(domain); for (final BudgetReAppropriation budgetReAppropriation : budgetreappropriations.getPagedData()) { contract = mapper.toContract(budgetReAppropriation); budgetReAppropriationContracts.add(contract); } final BudgetReAppropriationResponse response = new BudgetReAppropriationResponse(); response.setBudgetReAppropriations(budgetReAppropriationContracts); response.setPage(new PaginationContract(budgetreappropriations)); response.setResponseInfo(getResponseInfo(requestInfo)); return response; }
BudgetReAppropriationController { @PostMapping("/_search") @ResponseBody @ResponseStatus(HttpStatus.OK) public BudgetReAppropriationResponse search( @ModelAttribute final BudgetReAppropriationSearchContract budgetReAppropriationSearchContract, @RequestBody final RequestInfo requestInfo, final BindingResult errors) { final BudgetReAppropriationMapper mapper = new BudgetReAppropriationMapper(); final BudgetReAppropriationSearch domain = mapper.toSearchDomain(budgetReAppropriationSearchContract); BudgetReAppropriationContract contract = null; final List<BudgetReAppropriationContract> budgetReAppropriationContracts = new ArrayList<BudgetReAppropriationContract>(); final Pagination<BudgetReAppropriation> budgetreappropriations = budgetReAppropriationService.search(domain); for (final BudgetReAppropriation budgetReAppropriation : budgetreappropriations.getPagedData()) { contract = mapper.toContract(budgetReAppropriation); budgetReAppropriationContracts.add(contract); } final BudgetReAppropriationResponse response = new BudgetReAppropriationResponse(); response.setBudgetReAppropriations(budgetReAppropriationContracts); response.setPage(new PaginationContract(budgetreappropriations)); response.setResponseInfo(getResponseInfo(requestInfo)); return response; } }
BudgetReAppropriationController { @PostMapping("/_search") @ResponseBody @ResponseStatus(HttpStatus.OK) public BudgetReAppropriationResponse search( @ModelAttribute final BudgetReAppropriationSearchContract budgetReAppropriationSearchContract, @RequestBody final RequestInfo requestInfo, final BindingResult errors) { final BudgetReAppropriationMapper mapper = new BudgetReAppropriationMapper(); final BudgetReAppropriationSearch domain = mapper.toSearchDomain(budgetReAppropriationSearchContract); BudgetReAppropriationContract contract = null; final List<BudgetReAppropriationContract> budgetReAppropriationContracts = new ArrayList<BudgetReAppropriationContract>(); final Pagination<BudgetReAppropriation> budgetreappropriations = budgetReAppropriationService.search(domain); for (final BudgetReAppropriation budgetReAppropriation : budgetreappropriations.getPagedData()) { contract = mapper.toContract(budgetReAppropriation); budgetReAppropriationContracts.add(contract); } final BudgetReAppropriationResponse response = new BudgetReAppropriationResponse(); response.setBudgetReAppropriations(budgetReAppropriationContracts); response.setPage(new PaginationContract(budgetreappropriations)); response.setResponseInfo(getResponseInfo(requestInfo)); return response; }  }
BudgetReAppropriationController { @PostMapping("/_search") @ResponseBody @ResponseStatus(HttpStatus.OK) public BudgetReAppropriationResponse search( @ModelAttribute final BudgetReAppropriationSearchContract budgetReAppropriationSearchContract, @RequestBody final RequestInfo requestInfo, final BindingResult errors) { final BudgetReAppropriationMapper mapper = new BudgetReAppropriationMapper(); final BudgetReAppropriationSearch domain = mapper.toSearchDomain(budgetReAppropriationSearchContract); BudgetReAppropriationContract contract = null; final List<BudgetReAppropriationContract> budgetReAppropriationContracts = new ArrayList<BudgetReAppropriationContract>(); final Pagination<BudgetReAppropriation> budgetreappropriations = budgetReAppropriationService.search(domain); for (final BudgetReAppropriation budgetReAppropriation : budgetreappropriations.getPagedData()) { contract = mapper.toContract(budgetReAppropriation); budgetReAppropriationContracts.add(contract); } final BudgetReAppropriationResponse response = new BudgetReAppropriationResponse(); response.setBudgetReAppropriations(budgetReAppropriationContracts); response.setPage(new PaginationContract(budgetreappropriations)); response.setResponseInfo(getResponseInfo(requestInfo)); return response; }  @PostMapping("/_create") @ResponseStatus(HttpStatus.CREATED) BudgetReAppropriationResponse create(@RequestBody final BudgetReAppropriationRequest budgetReAppropriationRequest,
            final BindingResult errors); @PostMapping("/_update") @ResponseStatus(HttpStatus.CREATED) BudgetReAppropriationResponse update(
            @RequestBody @Valid final BudgetReAppropriationRequest budgetReAppropriationRequest, final BindingResult errors); @PostMapping("/_delete") @ResponseStatus(HttpStatus.CREATED) BudgetReAppropriationResponse delete(
            @RequestBody @Valid final BudgetReAppropriationRequest budgetReAppropriationRequest, final BindingResult errors); @PostMapping("/_search") @ResponseBody @ResponseStatus(HttpStatus.OK) BudgetReAppropriationResponse search(
            @ModelAttribute final BudgetReAppropriationSearchContract budgetReAppropriationSearchContract,
            @RequestBody final RequestInfo requestInfo, final BindingResult errors); }
BudgetReAppropriationController { @PostMapping("/_search") @ResponseBody @ResponseStatus(HttpStatus.OK) public BudgetReAppropriationResponse search( @ModelAttribute final BudgetReAppropriationSearchContract budgetReAppropriationSearchContract, @RequestBody final RequestInfo requestInfo, final BindingResult errors) { final BudgetReAppropriationMapper mapper = new BudgetReAppropriationMapper(); final BudgetReAppropriationSearch domain = mapper.toSearchDomain(budgetReAppropriationSearchContract); BudgetReAppropriationContract contract = null; final List<BudgetReAppropriationContract> budgetReAppropriationContracts = new ArrayList<BudgetReAppropriationContract>(); final Pagination<BudgetReAppropriation> budgetreappropriations = budgetReAppropriationService.search(domain); for (final BudgetReAppropriation budgetReAppropriation : budgetreappropriations.getPagedData()) { contract = mapper.toContract(budgetReAppropriation); budgetReAppropriationContracts.add(contract); } final BudgetReAppropriationResponse response = new BudgetReAppropriationResponse(); response.setBudgetReAppropriations(budgetReAppropriationContracts); response.setPage(new PaginationContract(budgetreappropriations)); response.setResponseInfo(getResponseInfo(requestInfo)); return response; }  @PostMapping("/_create") @ResponseStatus(HttpStatus.CREATED) BudgetReAppropriationResponse create(@RequestBody final BudgetReAppropriationRequest budgetReAppropriationRequest,
            final BindingResult errors); @PostMapping("/_update") @ResponseStatus(HttpStatus.CREATED) BudgetReAppropriationResponse update(
            @RequestBody @Valid final BudgetReAppropriationRequest budgetReAppropriationRequest, final BindingResult errors); @PostMapping("/_delete") @ResponseStatus(HttpStatus.CREATED) BudgetReAppropriationResponse delete(
            @RequestBody @Valid final BudgetReAppropriationRequest budgetReAppropriationRequest, final BindingResult errors); @PostMapping("/_search") @ResponseBody @ResponseStatus(HttpStatus.OK) BudgetReAppropriationResponse search(
            @ModelAttribute final BudgetReAppropriationSearchContract budgetReAppropriationSearchContract,
            @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; }