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