DepartmentController extends BaseController implements CrudController<DepartmentResource, DepartmentResource> { @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(value = Request.ID, method = RequestMethod.PUT) @ApiOperation(value = "Update Department") public MessageResource updateResource(@PathVariable("id") final Long id, @RequestBody final DepartmentResource departmentResource) { LOG.info("Updated department with id: {}, {}", id, departmentResource); facade.updateResource(id, departmentResource); return new MessageResource(MessageType.INFO, "Department Updated"); }  @Override @ResponseStatus(HttpStatus.CREATED) @RequestMapping(method = RequestMethod.POST) @ApiOperation(value = "Create Department") DepartmentResource createResource(@RequestBody final DepartmentResource departmentResource); @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(value = Request.ID, method = RequestMethod.PUT) @ApiOperation(value = "Update Department") MessageResource updateResource(@PathVariable("id") final Long id,
			@RequestBody final DepartmentResource departmentResource); @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(value = Request.ID, method = RequestMethod.GET) @ApiOperation(value = "Get Department by id") DepartmentResource getResource(@PathVariable("id") final Long id); @Override @ResponseStatus(HttpStatus.NO_CONTENT) @RequestMapping(value = Request.ID, method = RequestMethod.DELETE) @ApiOperation(value = "Delete Department by id") MessageResource removeResource(@PathVariable("id") final Long id); @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(method = RequestMethod.GET) @ApiOperation(value = "Get Departments") PagedResultResource<DepartmentResource> getPagedResource(final PagedRequest<DepartmentResource> request); @RequestMapping(value = "/timeperiods/{timePeriodId}/specoffers", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) List<DepartmentSpecofferResource> getDepartmentSpecoffers(@PathVariable("timePeriodId") long timePeriodId);  }
@Test public void testUpdateDepartment() throws Exception { Long id = 1L; String name = "fsd department"; String abbrName = "fds"; String manager = "manager"; DepartmentResource departmentResource = new DepartmentResource(); departmentResource.setId(id); departmentResource.setBegDate(new Date()); departmentResource.setEndDate(new Date()); departmentResource.setAbbrName(abbrName ); departmentResource.setName(name); departmentResource.setManager(manager); MessageResource responseResource = new MessageResource(MessageType.INFO, "Department Updated"); String request = getJson(departmentResource, true); String response = getJson(responseResource, false); mockMvc.perform(put("/departments/{id}", id) .contentType(MediaType.APPLICATION_JSON) .content(request)) .andExpect(status().isOk()) .andExpect(content().string(response)); verify(facade).updateResource(id, departmentResource); }