OrderController extends BaseController implements CrudController<OrderResource, OrderResource> { @Override @ResponseStatus(HttpStatus.CREATED) @RequestMapping(method = RequestMethod.POST) @ApiOperation(value = "Create Order", position = 1) public OrderResource createResource(@Valid @RequestBody final OrderResource orderResource) { LOG.info("Creating order: {}", orderResource); return facade.createResource(orderResource); }  @Override @ResponseStatus(HttpStatus.CREATED) @RequestMapping(method = RequestMethod.POST) @ApiOperation(value = "Create Order", position = 1) OrderResource createResource(@Valid @RequestBody final OrderResource orderResource); @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(value = Request.ID, method = RequestMethod.PUT) @ApiOperation(value = "Update Order", position = 2) MessageResource updateResource(@PathVariable("id") final Long id,
			@Valid @RequestBody final OrderResource resource); @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(value = Request.ID, method = RequestMethod.GET) @ApiOperation(value = "Get Order by id", position = 3) OrderResource getResource(@PathVariable("id") final Long id); @Override @ResponseStatus(HttpStatus.NO_CONTENT) @RequestMapping(value = Request.ID, method = RequestMethod.DELETE) @ApiOperation(value = "Delete Order", position = 4) MessageResource removeResource(@PathVariable("id") final Long id); @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(method = RequestMethod.GET) @ApiOperation(value = "Get Orders") PagedResultResource<OrderResource> getPagedResource(final PagedRequest<OrderResource> request);  }
@Test public void testCreateOrder() throws Exception { String docNum = "docNum"; OrderResource orderResource = new OrderResource(); orderResource.setDocNum(docNum); String request = getJson(orderResource, true); String response = getJson(orderResource, false); when(facade.createResource(any(OrderResource.class))).thenReturn(orderResource); mockMvc.perform(post("/orders") .contentType(MediaType.APPLICATION_JSON) .content(request)) .andExpect(status().isCreated()) .andExpect(content().string(response)); verify(facade).createResource(orderResource); }