PersonWorkController extends BaseController implements CrudController<PersonWorkResource, PersonWorkResource> { @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(value = "/{personId}/works/{id}", method = RequestMethod.PUT) public MessageResource updateResource(@PathVariable("id") final Long id, @Valid @RequestBody final PersonWorkResource resource) { LOG.info("Updated person work with id: {}, {}", id, resource); facade.updateResource(id, resource); return new MessageResource(MessageType.INFO, "PersonWork Updated"); }  @Override @ResponseStatus(HttpStatus.CREATED) @RequestMapping(value = "/{personId}/works", method = RequestMethod.POST) PersonWorkResource createResource(@Valid @RequestBody final PersonWorkResource resource); @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(value = "/{personId}/works/{id}", method = RequestMethod.PUT) MessageResource updateResource(@PathVariable("id") final Long id,
			@Valid @RequestBody final PersonWorkResource resource); @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(value = "/{personId}/works/{id}", method = RequestMethod.GET) PersonWorkResource getResource(@PathVariable("id") final Long id); @Override @ResponseStatus(HttpStatus.NO_CONTENT) @RequestMapping(value = "/{personId}/works/{id}", method = RequestMethod.DELETE) MessageResource removeResource(@PathVariable("id") final Long id); @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(value = "/{personId}/works", method = RequestMethod.GET) PagedResultResource<PersonWorkResource> getPagedResource(final PagedRequest<PersonWorkResource> request);  }
@Test public void testUpdatePersonWork() throws Exception { Long personId = 2L; Long id = 1L; PersonWorkResource personWorkResource = new PersonWorkResource(); personWorkResource.setId(id); personWorkResource.setPersonId(personId); MessageResource responseResource = new MessageResource( MessageType.INFO, "PersonWork Updated"); String request = getJson(personWorkResource, true); String response = getJson(responseResource, false); mockMvc.perform( put("/persons/{personId}/works/{workId}", personId, id) .contentType(MediaType.APPLICATION_JSON).content( request)).andExpect(status().isOk()) .andExpect(content().string(response)); verify(facade).updateResource(id, personWorkResource); }