PersonNameController extends BaseController implements CrudController<PersonNameResource, PersonNameResource> { @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(value = "/{personId}/names/{personNameId}", method = RequestMethod.PUT) @ApiOperation(value = "Update PersonName", position = 2) public MessageResource updateResource(@PathVariable("personNameId") final Long personNameId, @Valid @RequestBody final PersonNameResource resource) { LOG.info("Updating personName with id: {}, {}", personNameId, resource); facade.updateResource(personNameId, resource); return new MessageResource(MessageType.INFO, "Person Name Updated"); }  @Override @ResponseStatus(HttpStatus.CREATED) @RequestMapping(value = "/{personId}/names", method = RequestMethod.POST) @ApiOperation(value = "Create PersonName", position = 1) PersonNameResource createResource(@Valid @RequestBody final PersonNameResource resource); @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(value = "/{personId}/names/{personNameId}", method = RequestMethod.PUT) @ApiOperation(value = "Update PersonName", position = 2) MessageResource updateResource(@PathVariable("personNameId") final Long personNameId,
 			@Valid @RequestBody final PersonNameResource resource); @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(value = "/{personId}/names/{personNameId}", method = RequestMethod.GET) @ApiOperation(value = "Get PersonName by id", position = 3) PersonNameResource getResource(@PathVariable("personNameId") final Long personNameId); @Override @ResponseStatus(HttpStatus.NO_CONTENT) @RequestMapping(value = "/{personId}/names/{personNameId}", method = RequestMethod.DELETE) @ApiOperation(value = "Delete PersonName") MessageResource removeResource(@PathVariable("personNameId") final Long personNameId); @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(value = "/{personId}/names", method = RequestMethod.GET) @ApiOperation(value = "Get PersonNames") PagedResultResource<PersonNameResource> getPagedResource(final PagedRequest<PersonNameResource> request);  }
@Test public void testUpdatePersonName() throws Exception { Long id = 1L; Long personId = 1L; PersonNameResource personNameResource = new PersonNameResource(); personNameResource.setPersonId(personId); MessageResource responseResource = new MessageResource(MessageType.INFO, "Person Name Updated"); String request = getJson(personNameResource, true); String response = getJson(responseResource, false); mockMvc.perform(put("/persons/{personId}/names/{id}", personId, id) .contentType(MediaType.APPLICATION_JSON) .content(request)) .andExpect(status().isOk()) .andExpect(content().string(response)); verify(facade).updateResource(id, personNameResource); }