@Test public void testUpdateAll() throws IOException, Exception { mockMvc.perform(post("/bankbranches/_update") .content(resources.getFileContents("bankbranch/bankBranchContractUpdateAllRequest.json")) .contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) .andExpect(content().json(resources.getFileContents("bankbranch/bankBranchContractUpdateAllResponse.json"))); final ArgumentCaptor<BankBranchContractRequest> argumentCaptor = ArgumentCaptor .forClass(BankBranchContractRequest.class); verify(bankBranchService).validate(argumentCaptor.capture(), any(String.class), any(BindingResult.class)); verify(bankBranchService).fetchRelatedContracts(argumentCaptor.capture()); verify(bankBranchService).push(argumentCaptor.capture()); final BankBranchContractRequest actualRequest = argumentCaptor.getValue(); assertEquals("nameU", actualRequest.getBankBranches().get(0).getName()); assertEquals("codeU", actualRequest.getBankBranches().get(0).getCode()); assertEquals(Long.valueOf(1), actualRequest.getBankBranches().get(0).getId()); assertEquals(Long.valueOf(1), actualRequest.getBankBranches().get(0).getBank().getId()); assertEquals("default", actualRequest.getBankBranches().get(0).getTenantId()); }
@PostMapping("/_update") @ResponseStatus(HttpStatus.OK) public BankBranchContractResponse updateAll(@RequestBody @Valid BankBranchContractRequest bankBranchContractRequest, BindingResult errors) { bankBranchService.validate(bankBranchContractRequest, "updateAll", errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } bankBranchContractRequest.getRequestInfo().setAction("updateAll"); bankBranchService.fetchRelatedContracts(bankBranchContractRequest); bankBranchService.push(bankBranchContractRequest); BankBranchContractResponse bankBranchContractResponse = new BankBranchContractResponse(); bankBranchContractResponse.setBankBranches(new ArrayList<BankBranchContract>()); for (BankBranchContract bankBranchContract : bankBranchContractRequest.getBankBranches()) { bankBranchContractResponse.getBankBranches().add(bankBranchContract); } bankBranchContractResponse.setResponseInfo(getResponseInfo(bankBranchContractRequest.getRequestInfo())); bankBranchContractResponse.getResponseInfo().setStatus(HttpStatus.OK.toString()); return bankBranchContractResponse; }
BankBranchController { @PostMapping("/_update") @ResponseStatus(HttpStatus.OK) public BankBranchContractResponse updateAll(@RequestBody @Valid BankBranchContractRequest bankBranchContractRequest, BindingResult errors) { bankBranchService.validate(bankBranchContractRequest, "updateAll", errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } bankBranchContractRequest.getRequestInfo().setAction("updateAll"); bankBranchService.fetchRelatedContracts(bankBranchContractRequest); bankBranchService.push(bankBranchContractRequest); BankBranchContractResponse bankBranchContractResponse = new BankBranchContractResponse(); bankBranchContractResponse.setBankBranches(new ArrayList<BankBranchContract>()); for (BankBranchContract bankBranchContract : bankBranchContractRequest.getBankBranches()) { bankBranchContractResponse.getBankBranches().add(bankBranchContract); } bankBranchContractResponse.setResponseInfo(getResponseInfo(bankBranchContractRequest.getRequestInfo())); bankBranchContractResponse.getResponseInfo().setStatus(HttpStatus.OK.toString()); return bankBranchContractResponse; } }
BankBranchController { @PostMapping("/_update") @ResponseStatus(HttpStatus.OK) public BankBranchContractResponse updateAll(@RequestBody @Valid BankBranchContractRequest bankBranchContractRequest, BindingResult errors) { bankBranchService.validate(bankBranchContractRequest, "updateAll", errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } bankBranchContractRequest.getRequestInfo().setAction("updateAll"); bankBranchService.fetchRelatedContracts(bankBranchContractRequest); bankBranchService.push(bankBranchContractRequest); BankBranchContractResponse bankBranchContractResponse = new BankBranchContractResponse(); bankBranchContractResponse.setBankBranches(new ArrayList<BankBranchContract>()); for (BankBranchContract bankBranchContract : bankBranchContractRequest.getBankBranches()) { bankBranchContractResponse.getBankBranches().add(bankBranchContract); } bankBranchContractResponse.setResponseInfo(getResponseInfo(bankBranchContractRequest.getRequestInfo())); bankBranchContractResponse.getResponseInfo().setStatus(HttpStatus.OK.toString()); return bankBranchContractResponse; }  }
BankBranchController { @PostMapping("/_update") @ResponseStatus(HttpStatus.OK) public BankBranchContractResponse updateAll(@RequestBody @Valid BankBranchContractRequest bankBranchContractRequest, BindingResult errors) { bankBranchService.validate(bankBranchContractRequest, "updateAll", errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } bankBranchContractRequest.getRequestInfo().setAction("updateAll"); bankBranchService.fetchRelatedContracts(bankBranchContractRequest); bankBranchService.push(bankBranchContractRequest); BankBranchContractResponse bankBranchContractResponse = new BankBranchContractResponse(); bankBranchContractResponse.setBankBranches(new ArrayList<BankBranchContract>()); for (BankBranchContract bankBranchContract : bankBranchContractRequest.getBankBranches()) { bankBranchContractResponse.getBankBranches().add(bankBranchContract); } bankBranchContractResponse.setResponseInfo(getResponseInfo(bankBranchContractRequest.getRequestInfo())); bankBranchContractResponse.getResponseInfo().setStatus(HttpStatus.OK.toString()); return bankBranchContractResponse; }  @PostMapping("/_create") @ResponseStatus(HttpStatus.OK) BankBranchContractResponse create(@RequestBody @Valid BankBranchContractRequest bankBranchContractRequest,
			BindingResult errors); @PostMapping(value = "/{uniqueId}/_update") @ResponseStatus(HttpStatus.OK) BankBranchContractResponse update(@RequestBody @Valid BankBranchContractRequest bankBranchContractRequest,
			BindingResult errors, @PathVariable Long uniqueId); @PostMapping("/_update") @ResponseStatus(HttpStatus.OK) BankBranchContractResponse updateAll(@RequestBody @Valid BankBranchContractRequest bankBranchContractRequest,
			BindingResult errors); @PostMapping("/_search") @ResponseBody @ResponseStatus(HttpStatus.OK) BankBranchContractResponse search(@ModelAttribute BankBranchGetRequest bankBranchGetRequest,
			@RequestBody RequestInfo requestInfo, BindingResult errors); }
BankBranchController { @PostMapping("/_update") @ResponseStatus(HttpStatus.OK) public BankBranchContractResponse updateAll(@RequestBody @Valid BankBranchContractRequest bankBranchContractRequest, BindingResult errors) { bankBranchService.validate(bankBranchContractRequest, "updateAll", errors); if (errors.hasErrors()) { throw new CustomBindException(errors); } bankBranchContractRequest.getRequestInfo().setAction("updateAll"); bankBranchService.fetchRelatedContracts(bankBranchContractRequest); bankBranchService.push(bankBranchContractRequest); BankBranchContractResponse bankBranchContractResponse = new BankBranchContractResponse(); bankBranchContractResponse.setBankBranches(new ArrayList<BankBranchContract>()); for (BankBranchContract bankBranchContract : bankBranchContractRequest.getBankBranches()) { bankBranchContractResponse.getBankBranches().add(bankBranchContract); } bankBranchContractResponse.setResponseInfo(getResponseInfo(bankBranchContractRequest.getRequestInfo())); bankBranchContractResponse.getResponseInfo().setStatus(HttpStatus.OK.toString()); return bankBranchContractResponse; }  @PostMapping("/_create") @ResponseStatus(HttpStatus.OK) BankBranchContractResponse create(@RequestBody @Valid BankBranchContractRequest bankBranchContractRequest,
			BindingResult errors); @PostMapping(value = "/{uniqueId}/_update") @ResponseStatus(HttpStatus.OK) BankBranchContractResponse update(@RequestBody @Valid BankBranchContractRequest bankBranchContractRequest,
			BindingResult errors, @PathVariable Long uniqueId); @PostMapping("/_update") @ResponseStatus(HttpStatus.OK) BankBranchContractResponse updateAll(@RequestBody @Valid BankBranchContractRequest bankBranchContractRequest,
			BindingResult errors); @PostMapping("/_search") @ResponseBody @ResponseStatus(HttpStatus.OK) BankBranchContractResponse search(@ModelAttribute BankBranchGetRequest bankBranchGetRequest,
			@RequestBody RequestInfo requestInfo, BindingResult errors);  }