PersonEducationController extends BaseController implements CrudController<PersonEducationResource, PersonEducationResource> { @Override @ResponseStatus(HttpStatus.CREATED) @RequestMapping(value = "/{personId}/educations", method = RequestMethod.POST) public PersonEducationResource createResource(@Valid @RequestBody final PersonEducationResource resource) { LOG.info("Creating person language: {}", resource); return facade.createResource(resource); }  @Override @ResponseStatus(HttpStatus.CREATED) @RequestMapping(value = "/{personId}/educations", method = RequestMethod.POST) PersonEducationResource createResource(@Valid @RequestBody final PersonEducationResource resource); @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(value = "/{personId}/educations/{id}", method = RequestMethod.PUT) MessageResource updateResource(@PathVariable("id") final Long id,
			@Valid @RequestBody final PersonEducationResource resource); @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(value = "/{personId}/educations/{id}", method = RequestMethod.GET) PersonEducationResource getResource(@PathVariable("id") final Long id); @Override @ResponseStatus(HttpStatus.NO_CONTENT) @RequestMapping(value = "/{personId}/educations/{id}", method = RequestMethod.DELETE) MessageResource removeResource(@PathVariable("id") final Long id); @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(value = "/{personId}/educations", method = RequestMethod.GET) PagedResultResource<PersonEducationResource> getPagedResource(final PagedRequest<PersonEducationResource> request);  }
@Test public void testCreatePersonEducation() throws Exception { Long personId = 1L; Long id = 2L; PersonEducationResource personEducationResource = new PersonEducationResource(); personEducationResource.setId(id); String request = getJson(personEducationResource, true); String response = getJson(personEducationResource, false); when(facade.createResource(any(PersonEducationResource.class))) .thenReturn(personEducationResource); mockMvc.perform( post("/persons/{personId}/educations", personId).contentType( MediaType.APPLICATION_JSON).content(request)) .andExpect(status().isCreated()) .andExpect(content().string(response)); verify(facade).createResource(personEducationResource); }