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