DepartmentAddressController extends BaseController implements CrudController<DepartmentAddressResource, DepartmentAddressResource> { @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(value = "/{departmentId}/addresses/{id}", method = RequestMethod.PUT) public MessageResource updateResource(@PathVariable("id") final Long id, @Valid @RequestBody final DepartmentAddressResource resource) { LOG.info("Updated department address with id: {}, {}", id, resource); facade.updateResource(id, resource); return new MessageResource(MessageType.INFO, "DepartmentAddress Updated"); }  @Override @ResponseStatus(HttpStatus.CREATED) @RequestMapping(value = "/{departmentId}/addresses", method = RequestMethod.POST) DepartmentAddressResource createResource(@Valid @RequestBody final DepartmentAddressResource resource); @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(value = "/{departmentId}/addresses/{id}", method = RequestMethod.PUT) MessageResource updateResource(@PathVariable("id") final Long id,
			@Valid @RequestBody final DepartmentAddressResource resource); @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(value = "/{departmentId}/addresses/{id}", method = RequestMethod.GET) DepartmentAddressResource getResource(@PathVariable("id") final Long id); @Override @ResponseStatus(HttpStatus.NO_CONTENT) @RequestMapping(value = "/{departmentId}/addresses/{id}", method = RequestMethod.DELETE) MessageResource removeResource(@PathVariable("id") final Long id); @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(value = "/{departmentId}/addresses", method = RequestMethod.GET) PagedResultResource<DepartmentAddressResource> getPagedResource(final PagedRequest<DepartmentAddressResource> request);  }
@Test public void testUpdateDepartmentAddress() throws Exception { Long departmentId = 2L; Long id = 1L; DepartmentAddressResource departmentAddressResource = new DepartmentAddressResource(); departmentAddressResource.setId(id); departmentAddressResource.setDepartmentId(departmentId); MessageResource responseResource = new MessageResource(MessageType.INFO, "DepartmentAddress Updated"); String request = getJson(departmentAddressResource, true); String response = getJson(responseResource, false); mockMvc.perform(put("/departments/{departmentId}/addresses/{addressId}", departmentId, id) .contentType(MediaType.APPLICATION_JSON) .content(request)) .andExpect(status().isOk()) .andExpect(content().string(response)); verify(facade).updateResource(id, departmentAddressResource); }