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