@Test public void createVitrificationMachine() throws Exception { final VitrificationMachine vitrificationMachine = VitrificationMachine.builder() .label("label 3") .manufacturer("A manufacturer") .model("The new model") .location("In the basement") .build(); final String json = new ObjectMapper().writeValueAsString(vitrificationMachine); getMockMvc().perform(post(URI).contentType(JSON_CONTENT_TYPE).content(json)).andExpect(status().isCreated()); verify(service, times(1)).createItem(vitrificationMachine); }
@NonNull @PostMapping @ResponseStatus(HttpStatus.CREATED) public VitrificationMachine createItem(@NonNull @Valid @RequestBody VitrificationMachine input) { return this.service.createItem(input); }
VitrificationMachineRestController extends BaseValidatingRestController<VitrificationMachine, VitrificationMachineService> { @NonNull @PostMapping @ResponseStatus(HttpStatus.CREATED) public VitrificationMachine createItem(@NonNull @Valid @RequestBody VitrificationMachine input) { return this.service.createItem(input); } }
VitrificationMachineRestController extends BaseValidatingRestController<VitrificationMachine, VitrificationMachineService> { @NonNull @PostMapping @ResponseStatus(HttpStatus.CREATED) public VitrificationMachine createItem(@NonNull @Valid @RequestBody VitrificationMachine input) { return this.service.createItem(input); } @Autowired  VitrificationMachineRestController(final VitrificationMachineService service,
                                       final VitrificationMachineValidator validator); }
VitrificationMachineRestController extends BaseValidatingRestController<VitrificationMachine, VitrificationMachineService> { @NonNull @PostMapping @ResponseStatus(HttpStatus.CREATED) public VitrificationMachine createItem(@NonNull @Valid @RequestBody VitrificationMachine input) { return this.service.createItem(input); } @Autowired  VitrificationMachineRestController(final VitrificationMachineService service,
                                       final VitrificationMachineValidator validator); @NonNull @PostMapping @ResponseStatus(HttpStatus.CREATED) VitrificationMachine createItem(@NonNull @Valid @RequestBody VitrificationMachine input); }
VitrificationMachineRestController extends BaseValidatingRestController<VitrificationMachine, VitrificationMachineService> { @NonNull @PostMapping @ResponseStatus(HttpStatus.CREATED) public VitrificationMachine createItem(@NonNull @Valid @RequestBody VitrificationMachine input) { return this.service.createItem(input); } @Autowired  VitrificationMachineRestController(final VitrificationMachineService service,
                                       final VitrificationMachineValidator validator); @NonNull @PostMapping @ResponseStatus(HttpStatus.CREATED) VitrificationMachine createItem(@NonNull @Valid @RequestBody VitrificationMachine input);  }