@Test public void createBlottingPaper() throws Exception { final BlottingPaper blottingPaper = BlottingPaper.builder() .label("label 3") .manufacturer("A manufacturer") .model("The new model") .build(); final String json = new ObjectMapper().writeValueAsString(blottingPaper); getMockMvc().perform(post(URI).contentType(JSON_CONTENT_TYPE).content(json)).andExpect(status().isCreated()); verify(service, times(1)).createItem(blottingPaper); }
@NonNull @PostMapping @ResponseStatus(HttpStatus.CREATED) public BlottingPaper createItem(@NonNull @Valid @RequestBody BlottingPaper input) { return this.service.createItem(input); }
BlottingPaperRestController extends BaseValidatingRestController<BlottingPaper, BlottingPaperService> { @NonNull @PostMapping @ResponseStatus(HttpStatus.CREATED) public BlottingPaper createItem(@NonNull @Valid @RequestBody BlottingPaper input) { return this.service.createItem(input); } }
BlottingPaperRestController extends BaseValidatingRestController<BlottingPaper, BlottingPaperService> { @NonNull @PostMapping @ResponseStatus(HttpStatus.CREATED) public BlottingPaper createItem(@NonNull @Valid @RequestBody BlottingPaper input) { return this.service.createItem(input); } @Autowired  BlottingPaperRestController(final BlottingPaperService service,
                                final BlottingPaperValidator validator); }
BlottingPaperRestController extends BaseValidatingRestController<BlottingPaper, BlottingPaperService> { @NonNull @PostMapping @ResponseStatus(HttpStatus.CREATED) public BlottingPaper createItem(@NonNull @Valid @RequestBody BlottingPaper input) { return this.service.createItem(input); } @Autowired  BlottingPaperRestController(final BlottingPaperService service,
                                final BlottingPaperValidator validator); @NonNull @PostMapping @ResponseStatus(HttpStatus.CREATED) BlottingPaper createItem(@NonNull @Valid @RequestBody BlottingPaper input); }
BlottingPaperRestController extends BaseValidatingRestController<BlottingPaper, BlottingPaperService> { @NonNull @PostMapping @ResponseStatus(HttpStatus.CREATED) public BlottingPaper createItem(@NonNull @Valid @RequestBody BlottingPaper input) { return this.service.createItem(input); } @Autowired  BlottingPaperRestController(final BlottingPaperService service,
                                final BlottingPaperValidator validator); @NonNull @PostMapping @ResponseStatus(HttpStatus.CREATED) BlottingPaper createItem(@NonNull @Valid @RequestBody BlottingPaper input);  }