@Test public void test_create_error() throws IOException, Exception { when(instrumentAccountCodeService.create(any(List.class), any(BindingResult.class), any(RequestInfo.class))) .thenReturn(getInstrumentAccountCodes()); mockMvc.perform(post("/instrumentaccountcodes/_create") .content(resources .readRequest("instrumentaccountcode/instrumentaccountcode_create_invalid_field_value.json")) .contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().is5xxServerError()); }
@PostMapping("/_create") @ResponseStatus(HttpStatus.CREATED) public InstrumentAccountCodeResponse create(@RequestBody InstrumentAccountCodeRequest instrumentAccountCodeRequest, BindingResult errors) { InstrumentAccountCodeMapper mapper = new InstrumentAccountCodeMapper(); InstrumentAccountCodeResponse instrumentAccountCodeResponse = new InstrumentAccountCodeResponse(); instrumentAccountCodeResponse.setResponseInfo(getResponseInfo(instrumentAccountCodeRequest.getRequestInfo())); List<InstrumentAccountCode> instrumentaccountcodes = new ArrayList<>(); InstrumentAccountCode instrumentAccountCode; List<InstrumentAccountCodeContract> instrumentAccountCodeContracts = new ArrayList<>(); InstrumentAccountCodeContract contract; instrumentAccountCodeRequest.getRequestInfo().setAction(ACTION_CREATE); for (InstrumentAccountCodeContract instrumentAccountCodeContract : instrumentAccountCodeRequest .getInstrumentAccountCodes()) { instrumentAccountCode = mapper.toDomain(instrumentAccountCodeContract); instrumentAccountCode.setCreatedDate(new Date()); instrumentAccountCode.setCreatedBy(instrumentAccountCodeRequest.getRequestInfo().getUserInfo()); instrumentAccountCode.setLastModifiedBy(instrumentAccountCodeRequest.getRequestInfo().getUserInfo()); instrumentaccountcodes.add(instrumentAccountCode); } instrumentaccountcodes = instrumentAccountCodeService.create(instrumentaccountcodes, errors, instrumentAccountCodeRequest.getRequestInfo()); for (InstrumentAccountCode iac : instrumentaccountcodes) { contract = mapper.toContract(iac); instrumentAccountCodeContracts.add(contract); } instrumentAccountCodeResponse.setInstrumentAccountCodes(instrumentAccountCodeContracts); return instrumentAccountCodeResponse; }
InstrumentAccountCodeController { @PostMapping("/_create") @ResponseStatus(HttpStatus.CREATED) public InstrumentAccountCodeResponse create(@RequestBody InstrumentAccountCodeRequest instrumentAccountCodeRequest, BindingResult errors) { InstrumentAccountCodeMapper mapper = new InstrumentAccountCodeMapper(); InstrumentAccountCodeResponse instrumentAccountCodeResponse = new InstrumentAccountCodeResponse(); instrumentAccountCodeResponse.setResponseInfo(getResponseInfo(instrumentAccountCodeRequest.getRequestInfo())); List<InstrumentAccountCode> instrumentaccountcodes = new ArrayList<>(); InstrumentAccountCode instrumentAccountCode; List<InstrumentAccountCodeContract> instrumentAccountCodeContracts = new ArrayList<>(); InstrumentAccountCodeContract contract; instrumentAccountCodeRequest.getRequestInfo().setAction(ACTION_CREATE); for (InstrumentAccountCodeContract instrumentAccountCodeContract : instrumentAccountCodeRequest .getInstrumentAccountCodes()) { instrumentAccountCode = mapper.toDomain(instrumentAccountCodeContract); instrumentAccountCode.setCreatedDate(new Date()); instrumentAccountCode.setCreatedBy(instrumentAccountCodeRequest.getRequestInfo().getUserInfo()); instrumentAccountCode.setLastModifiedBy(instrumentAccountCodeRequest.getRequestInfo().getUserInfo()); instrumentaccountcodes.add(instrumentAccountCode); } instrumentaccountcodes = instrumentAccountCodeService.create(instrumentaccountcodes, errors, instrumentAccountCodeRequest.getRequestInfo()); for (InstrumentAccountCode iac : instrumentaccountcodes) { contract = mapper.toContract(iac); instrumentAccountCodeContracts.add(contract); } instrumentAccountCodeResponse.setInstrumentAccountCodes(instrumentAccountCodeContracts); return instrumentAccountCodeResponse; } }
InstrumentAccountCodeController { @PostMapping("/_create") @ResponseStatus(HttpStatus.CREATED) public InstrumentAccountCodeResponse create(@RequestBody InstrumentAccountCodeRequest instrumentAccountCodeRequest, BindingResult errors) { InstrumentAccountCodeMapper mapper = new InstrumentAccountCodeMapper(); InstrumentAccountCodeResponse instrumentAccountCodeResponse = new InstrumentAccountCodeResponse(); instrumentAccountCodeResponse.setResponseInfo(getResponseInfo(instrumentAccountCodeRequest.getRequestInfo())); List<InstrumentAccountCode> instrumentaccountcodes = new ArrayList<>(); InstrumentAccountCode instrumentAccountCode; List<InstrumentAccountCodeContract> instrumentAccountCodeContracts = new ArrayList<>(); InstrumentAccountCodeContract contract; instrumentAccountCodeRequest.getRequestInfo().setAction(ACTION_CREATE); for (InstrumentAccountCodeContract instrumentAccountCodeContract : instrumentAccountCodeRequest .getInstrumentAccountCodes()) { instrumentAccountCode = mapper.toDomain(instrumentAccountCodeContract); instrumentAccountCode.setCreatedDate(new Date()); instrumentAccountCode.setCreatedBy(instrumentAccountCodeRequest.getRequestInfo().getUserInfo()); instrumentAccountCode.setLastModifiedBy(instrumentAccountCodeRequest.getRequestInfo().getUserInfo()); instrumentaccountcodes.add(instrumentAccountCode); } instrumentaccountcodes = instrumentAccountCodeService.create(instrumentaccountcodes, errors, instrumentAccountCodeRequest.getRequestInfo()); for (InstrumentAccountCode iac : instrumentaccountcodes) { contract = mapper.toContract(iac); instrumentAccountCodeContracts.add(contract); } instrumentAccountCodeResponse.setInstrumentAccountCodes(instrumentAccountCodeContracts); return instrumentAccountCodeResponse; }  }
InstrumentAccountCodeController { @PostMapping("/_create") @ResponseStatus(HttpStatus.CREATED) public InstrumentAccountCodeResponse create(@RequestBody InstrumentAccountCodeRequest instrumentAccountCodeRequest, BindingResult errors) { InstrumentAccountCodeMapper mapper = new InstrumentAccountCodeMapper(); InstrumentAccountCodeResponse instrumentAccountCodeResponse = new InstrumentAccountCodeResponse(); instrumentAccountCodeResponse.setResponseInfo(getResponseInfo(instrumentAccountCodeRequest.getRequestInfo())); List<InstrumentAccountCode> instrumentaccountcodes = new ArrayList<>(); InstrumentAccountCode instrumentAccountCode; List<InstrumentAccountCodeContract> instrumentAccountCodeContracts = new ArrayList<>(); InstrumentAccountCodeContract contract; instrumentAccountCodeRequest.getRequestInfo().setAction(ACTION_CREATE); for (InstrumentAccountCodeContract instrumentAccountCodeContract : instrumentAccountCodeRequest .getInstrumentAccountCodes()) { instrumentAccountCode = mapper.toDomain(instrumentAccountCodeContract); instrumentAccountCode.setCreatedDate(new Date()); instrumentAccountCode.setCreatedBy(instrumentAccountCodeRequest.getRequestInfo().getUserInfo()); instrumentAccountCode.setLastModifiedBy(instrumentAccountCodeRequest.getRequestInfo().getUserInfo()); instrumentaccountcodes.add(instrumentAccountCode); } instrumentaccountcodes = instrumentAccountCodeService.create(instrumentaccountcodes, errors, instrumentAccountCodeRequest.getRequestInfo()); for (InstrumentAccountCode iac : instrumentaccountcodes) { contract = mapper.toContract(iac); instrumentAccountCodeContracts.add(contract); } instrumentAccountCodeResponse.setInstrumentAccountCodes(instrumentAccountCodeContracts); return instrumentAccountCodeResponse; }  @PostMapping("/_create") @ResponseStatus(HttpStatus.CREATED) InstrumentAccountCodeResponse create(@RequestBody InstrumentAccountCodeRequest instrumentAccountCodeRequest,
            BindingResult errors); @PostMapping("/_update") @ResponseStatus(HttpStatus.CREATED) InstrumentAccountCodeResponse update(@RequestBody InstrumentAccountCodeRequest instrumentAccountCodeRequest,
            BindingResult errors); @PostMapping("/_delete") @ResponseStatus(HttpStatus.CREATED) InstrumentAccountCodeResponse delete(@RequestBody InstrumentAccountCodeRequest instrumentAccountCodeRequest,
            BindingResult errors); @PostMapping("/_search") @ResponseBody @ResponseStatus(HttpStatus.OK) InstrumentAccountCodeResponse search(
            @ModelAttribute InstrumentAccountCodeSearchContract instrumentAccountCodeSearchContract,
            RequestInfo requestInfo, BindingResult errors); }
InstrumentAccountCodeController { @PostMapping("/_create") @ResponseStatus(HttpStatus.CREATED) public InstrumentAccountCodeResponse create(@RequestBody InstrumentAccountCodeRequest instrumentAccountCodeRequest, BindingResult errors) { InstrumentAccountCodeMapper mapper = new InstrumentAccountCodeMapper(); InstrumentAccountCodeResponse instrumentAccountCodeResponse = new InstrumentAccountCodeResponse(); instrumentAccountCodeResponse.setResponseInfo(getResponseInfo(instrumentAccountCodeRequest.getRequestInfo())); List<InstrumentAccountCode> instrumentaccountcodes = new ArrayList<>(); InstrumentAccountCode instrumentAccountCode; List<InstrumentAccountCodeContract> instrumentAccountCodeContracts = new ArrayList<>(); InstrumentAccountCodeContract contract; instrumentAccountCodeRequest.getRequestInfo().setAction(ACTION_CREATE); for (InstrumentAccountCodeContract instrumentAccountCodeContract : instrumentAccountCodeRequest .getInstrumentAccountCodes()) { instrumentAccountCode = mapper.toDomain(instrumentAccountCodeContract); instrumentAccountCode.setCreatedDate(new Date()); instrumentAccountCode.setCreatedBy(instrumentAccountCodeRequest.getRequestInfo().getUserInfo()); instrumentAccountCode.setLastModifiedBy(instrumentAccountCodeRequest.getRequestInfo().getUserInfo()); instrumentaccountcodes.add(instrumentAccountCode); } instrumentaccountcodes = instrumentAccountCodeService.create(instrumentaccountcodes, errors, instrumentAccountCodeRequest.getRequestInfo()); for (InstrumentAccountCode iac : instrumentaccountcodes) { contract = mapper.toContract(iac); instrumentAccountCodeContracts.add(contract); } instrumentAccountCodeResponse.setInstrumentAccountCodes(instrumentAccountCodeContracts); return instrumentAccountCodeResponse; }  @PostMapping("/_create") @ResponseStatus(HttpStatus.CREATED) InstrumentAccountCodeResponse create(@RequestBody InstrumentAccountCodeRequest instrumentAccountCodeRequest,
            BindingResult errors); @PostMapping("/_update") @ResponseStatus(HttpStatus.CREATED) InstrumentAccountCodeResponse update(@RequestBody InstrumentAccountCodeRequest instrumentAccountCodeRequest,
            BindingResult errors); @PostMapping("/_delete") @ResponseStatus(HttpStatus.CREATED) InstrumentAccountCodeResponse delete(@RequestBody InstrumentAccountCodeRequest instrumentAccountCodeRequest,
            BindingResult errors); @PostMapping("/_search") @ResponseBody @ResponseStatus(HttpStatus.OK) InstrumentAccountCodeResponse search(
            @ModelAttribute InstrumentAccountCodeSearchContract instrumentAccountCodeSearchContract,
            RequestInfo requestInfo, BindingResult errors); static final String ACTION_CREATE; static final String ACTION_UPDATE; static final String ACTION_DELETE; static final String PLACEHOLDER; }