@Test public void createSurfaceTreatmentProtocol() throws Exception { final SurfaceTreatmentProtocol protocol = SurfaceTreatmentProtocol.builder() .label("label 3") .duration(1f) .current(1f) .pressure(1f) .machine(new SurfaceTreatmentMachine()) .build(); final String json = new ObjectMapper().writeValueAsString(protocol); getMockMvc().perform(post(URI).contentType(JSON_CONTENT_TYPE).content(json)).andExpect(status().isCreated()); verify(service, times(1)).createItem(protocol); }
@NonNull @PostMapping @ResponseStatus(HttpStatus.CREATED) public SurfaceTreatmentProtocol createItem(@NonNull @Valid @RequestBody SurfaceTreatmentProtocol input) { return this.service.createItem(input); }
SurfaceTreatmentProtocolRestController extends BaseValidatingRestController<SurfaceTreatmentProtocol,
        SurfaceTreatmentProtocolService> { @NonNull @PostMapping @ResponseStatus(HttpStatus.CREATED) public SurfaceTreatmentProtocol createItem(@NonNull @Valid @RequestBody SurfaceTreatmentProtocol input) { return this.service.createItem(input); } }
SurfaceTreatmentProtocolRestController extends BaseValidatingRestController<SurfaceTreatmentProtocol,
        SurfaceTreatmentProtocolService> { @NonNull @PostMapping @ResponseStatus(HttpStatus.CREATED) public SurfaceTreatmentProtocol createItem(@NonNull @Valid @RequestBody SurfaceTreatmentProtocol input) { return this.service.createItem(input); } @Autowired  SurfaceTreatmentProtocolRestController(final SurfaceTreatmentProtocolService service,
                                           final SurfaceTreatmentProtocolValidator validator); }
SurfaceTreatmentProtocolRestController extends BaseValidatingRestController<SurfaceTreatmentProtocol,
        SurfaceTreatmentProtocolService> { @NonNull @PostMapping @ResponseStatus(HttpStatus.CREATED) public SurfaceTreatmentProtocol createItem(@NonNull @Valid @RequestBody SurfaceTreatmentProtocol input) { return this.service.createItem(input); } @Autowired  SurfaceTreatmentProtocolRestController(final SurfaceTreatmentProtocolService service,
                                           final SurfaceTreatmentProtocolValidator validator); @NonNull @PostMapping @ResponseStatus(HttpStatus.CREATED) SurfaceTreatmentProtocol createItem(@NonNull @Valid @RequestBody SurfaceTreatmentProtocol input); }
SurfaceTreatmentProtocolRestController extends BaseValidatingRestController<SurfaceTreatmentProtocol,
        SurfaceTreatmentProtocolService> { @NonNull @PostMapping @ResponseStatus(HttpStatus.CREATED) public SurfaceTreatmentProtocol createItem(@NonNull @Valid @RequestBody SurfaceTreatmentProtocol input) { return this.service.createItem(input); } @Autowired  SurfaceTreatmentProtocolRestController(final SurfaceTreatmentProtocolService service,
                                           final SurfaceTreatmentProtocolValidator validator); @NonNull @PostMapping @ResponseStatus(HttpStatus.CREATED) SurfaceTreatmentProtocol createItem(@NonNull @Valid @RequestBody SurfaceTreatmentProtocol input);  }