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