SpecialtyController extends BaseController implements CrudController<SpecialtyResource, SpecialtyResource> { @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(value = Request.ID, method = RequestMethod.PUT) @ApiOperation(value = "Update Specialty", position = 2) public MessageResource updateResource(@PathVariable("id") final Long id, @Valid @RequestBody final SpecialtyResource specialtyResource) { LOG.info("Updated specialty with id: {}, {}", id, specialtyResource); facade.updateResource(id, specialtyResource); return new MessageResource(MessageType.INFO, "Specialty Updated"); }  @Override @ResponseStatus(HttpStatus.CREATED) @RequestMapping(method = RequestMethod.POST) @ApiOperation(value = "Create Specialty", position = 1) SpecialtyResource createResource(@Valid @RequestBody final SpecialtyResource specialtyResource); @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(value = Request.ID, method = RequestMethod.PUT) @ApiOperation(value = "Update Specialty", position = 2) MessageResource updateResource(@PathVariable("id") final Long id,
			@Valid @RequestBody final SpecialtyResource specialtyResource); @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(value = Request.ID, method = RequestMethod.GET) @ApiOperation(value = "Get Specailty by id", position = 3) SpecialtyResource getResource(@PathVariable("id") final Long id); @Override @ResponseStatus(HttpStatus.NO_CONTENT) @RequestMapping(value = Request.ID, method = RequestMethod.DELETE) @ApiOperation(value = "Delete Specialty", position = 4) MessageResource removeResource(@PathVariable("id") final Long id); @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(method = RequestMethod.GET) @ApiOperation(value = "Get Specailties", position = 5) PagedResultResource<SpecialtyResource> getPagedResource(final PagedRequest<SpecialtyResource> request);  }
@Test public void testUpdateSpecialty() throws Exception { Long id = 1L; String name = "fsd specialty"; Long specialtyTypeId = 25L; String abbrName = "fds"; String cipher = "534tgfds"; SpecialtyResource specialtyResource = new SpecialtyResource(); specialtyResource.setId(id); specialtyResource.setBegDate(new Date()); specialtyResource.setEndDate(new Date()); specialtyResource.setAbbrName(abbrName ); specialtyResource.setCipher(cipher); specialtyResource.setName(name); specialtyResource.setSpecialtyTypeId(specialtyTypeId); MessageResource responseResource = new MessageResource(MessageType.INFO, "Specialty Updated"); String request = getJson(specialtyResource, true); String response = getJson(responseResource, false); mockMvc.perform(put("/specialties/{id}", id) .contentType(MediaType.APPLICATION_JSON) .content(request)) .andExpect(status().isOk()) .andExpect(content().string(response)); verify(facade).updateResource(id, specialtyResource); }