PersonAddressController extends BaseController implements CrudController<PersonAddressResource, PersonAddressResource> { @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(value = "/{personId}/addresses/{addressId}", method = RequestMethod.PUT) @ApiOperation(value = "Method for updating person address") public MessageResource updateResource(@PathVariable("addressId") final Long addressId, @Valid @RequestBody final PersonAddressResource resource) { LOG.info("Updating person address({}): {}", addressId, resource); facade.updateResource(addressId, resource); return new MessageResource(MessageType.INFO, "Person address updated"); }  @Override @ResponseStatus(HttpStatus.CREATED) @RequestMapping(value = "/{personId}/addresses", method = RequestMethod.POST) @ApiOperation(value = "Method for creating person address") PersonAddressResource createResource(@Valid @RequestBody final PersonAddressResource resource); @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(value = "/{personId}/addresses/{addressId}", method = RequestMethod.PUT) @ApiOperation(value = "Method for updating person address") MessageResource updateResource(@PathVariable("addressId") final Long addressId,
			@Valid @RequestBody final PersonAddressResource resource); @Override @ResponseStatus(HttpStatus.NO_CONTENT) @RequestMapping(value = "/{personId}/addresses/{addressId}", method = RequestMethod.DELETE) @ApiOperation(value = "Method for deleting person address") MessageResource removeResource(@PathVariable("addressId") final Long addressId); @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(value = "/{personId}/addresses/{addressId}", method = RequestMethod.GET) @ApiOperation(value = "Method for getting person address by id") PersonAddressResource getResource(@PathVariable("addressId") final Long addressId); @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(value = "/{personId}/addresses", method = RequestMethod.GET) @ApiOperation(value = "Method for getting paged result.") PagedResultResource<PersonAddressResource> getPagedResource(final PagedRequest<PersonAddressResource> request);  }
@Test public void testUpdatePersonAddress() throws Exception { Long personId = 2L; Long id = 1L; PersonAddressResource personAddressResource = new PersonAddressResource(); personAddressResource.setId(id); personAddressResource.setPersonId(personId); MessageResource responseResource = new MessageResource(MessageType.INFO, "Person address updated"); String request = getJson(personAddressResource, true); String response = getJson(responseResource, false); mockMvc.perform(put("/persons/{persinId}/addresses/{addressId}", personId, id) .contentType(MediaType.APPLICATION_JSON) .content(request)) .andExpect(status().isOk()) .andExpect(content().string(response)); verify(facade).updateResource(id, personAddressResource); }