@Test public void createCryoStorageDevice() throws Exception { final CryoStorageDevice device = CryoStorageDevice.builder().label("My machine").build(); final String json = new ObjectMapper().writeValueAsString(device); getMockMvc().perform(post(URI).contentType(JSON_CONTENT_TYPE).content(json)).andExpect(status().isCreated()); verify(service, times(1)).createItem(device); }
@NonNull @PostMapping @ResponseStatus(HttpStatus.CREATED) public CryoStorageDevice createItem(@NotNull @Valid @RequestBody final CryoStorageDevice device) { return this.service.createItem(device); }
CryoStorageDeviceRestController extends BaseValidatingRestController<CryoStorageDevice, CryoStorageDeviceService> { @NonNull @PostMapping @ResponseStatus(HttpStatus.CREATED) public CryoStorageDevice createItem(@NotNull @Valid @RequestBody final CryoStorageDevice device) { return this.service.createItem(device); } }
CryoStorageDeviceRestController extends BaseValidatingRestController<CryoStorageDevice, CryoStorageDeviceService> { @NonNull @PostMapping @ResponseStatus(HttpStatus.CREATED) public CryoStorageDevice createItem(@NotNull @Valid @RequestBody final CryoStorageDevice device) { return this.service.createItem(device); } @Autowired  CryoStorageDeviceRestController(@NotNull final CryoStorageDeviceService service,
                                           @NotNull final CryoStorageDeviceValidator validator); }
CryoStorageDeviceRestController extends BaseValidatingRestController<CryoStorageDevice, CryoStorageDeviceService> { @NonNull @PostMapping @ResponseStatus(HttpStatus.CREATED) public CryoStorageDevice createItem(@NotNull @Valid @RequestBody final CryoStorageDevice device) { return this.service.createItem(device); } @Autowired  CryoStorageDeviceRestController(@NotNull final CryoStorageDeviceService service,
                                           @NotNull final CryoStorageDeviceValidator validator); @NonNull @PostMapping @ResponseStatus(HttpStatus.CREATED) CryoStorageDevice createItem(@NotNull @Valid @RequestBody final CryoStorageDevice device); }
CryoStorageDeviceRestController extends BaseValidatingRestController<CryoStorageDevice, CryoStorageDeviceService> { @NonNull @PostMapping @ResponseStatus(HttpStatus.CREATED) public CryoStorageDevice createItem(@NotNull @Valid @RequestBody final CryoStorageDevice device) { return this.service.createItem(device); } @Autowired  CryoStorageDeviceRestController(@NotNull final CryoStorageDeviceService service,
                                           @NotNull final CryoStorageDeviceValidator validator); @NonNull @PostMapping @ResponseStatus(HttpStatus.CREATED) CryoStorageDevice createItem(@NotNull @Valid @RequestBody final CryoStorageDevice device);  }