@Test public void createGridType() throws Exception { final GridType gridType = GridType.builder() .label("label 3") .manufacturer("Simens") .description("Lorem Ipsum") .build(); final String json = new ObjectMapper().writeValueAsString(gridType); getMockMvc().perform(post(URI).contentType(JSON_CONTENT_TYPE).content(json)).andExpect(status().isCreated()); verify(service, times(1)).createItem(gridType); }
@NonNull @PostMapping @ResponseStatus(HttpStatus.CREATED) public GridType createItem(@NonNull @Valid @RequestBody GridType input) { return this.service.createItem(input); }
GridTypeRestController extends BaseValidatingRestController<GridType, GridTypeService> { @NonNull @PostMapping @ResponseStatus(HttpStatus.CREATED) public GridType createItem(@NonNull @Valid @RequestBody GridType input) { return this.service.createItem(input); } }
GridTypeRestController extends BaseValidatingRestController<GridType, GridTypeService> { @NonNull @PostMapping @ResponseStatus(HttpStatus.CREATED) public GridType createItem(@NonNull @Valid @RequestBody GridType input) { return this.service.createItem(input); } @Autowired  GridTypeRestController(final GridTypeService service,
                           final GridTypeValidator validator); }
GridTypeRestController extends BaseValidatingRestController<GridType, GridTypeService> { @NonNull @PostMapping @ResponseStatus(HttpStatus.CREATED) public GridType createItem(@NonNull @Valid @RequestBody GridType input) { return this.service.createItem(input); } @Autowired  GridTypeRestController(final GridTypeService service,
                           final GridTypeValidator validator); @NonNull @PostMapping @ResponseStatus(HttpStatus.CREATED) GridType createItem(@NonNull @Valid @RequestBody GridType input); }
GridTypeRestController extends BaseValidatingRestController<GridType, GridTypeService> { @NonNull @PostMapping @ResponseStatus(HttpStatus.CREATED) public GridType createItem(@NonNull @Valid @RequestBody GridType input) { return this.service.createItem(input); } @Autowired  GridTypeRestController(final GridTypeService service,
                           final GridTypeValidator validator); @NonNull @PostMapping @ResponseStatus(HttpStatus.CREATED) GridType createItem(@NonNull @Valid @RequestBody GridType input);  }