TimePeriodController extends BaseController implements CrudController<TimePeriodResource, TimePeriodResource> { @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(value = Request.ID, method = RequestMethod.PUT) @ApiOperation(value = "Update TimePeriod") public MessageResource updateResource(@PathVariable("id") final Long id, @Valid @RequestBody final TimePeriodResource resource) { LOG.info("Updating timePeriod with id: {}, {}", id, resource); facade.updateResource(id, resource); return new MessageResource(MessageType.INFO, "TimePeriod Updated"); }  @Override @ResponseStatus(HttpStatus.CREATED) @RequestMapping(method = RequestMethod.POST) @ApiOperation(value = "Create Person") TimePeriodResource createResource(@Valid @RequestBody final TimePeriodResource resource); @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(value = Request.ID, method = RequestMethod.PUT) @ApiOperation(value = "Update TimePeriod") MessageResource updateResource(@PathVariable("id") final Long id,
			@Valid @RequestBody final TimePeriodResource resource); @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(value = Request.ID, method = RequestMethod.GET) @ApiOperation(value = "Get TimePeriod by id") TimePeriodResource getResource(@PathVariable("id") final Long id); @Override @ResponseStatus(HttpStatus.NO_CONTENT) @RequestMapping(value = Request.ID, method = RequestMethod.DELETE) @ApiOperation(value = "Delete TimePeriod") MessageResource removeResource(@PathVariable("id") final Long id); @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(method = RequestMethod.GET) @ApiOperation(value = "Get Time Periods") PagedResultResource<TimePeriodResource> getPagedResource(@Limit(defaultValue = "38") final PagedRequest<TimePeriodResource> request);  }
@Test public void testUpdateTimePeriod() throws Exception { Long id = 1L; TimePeriodResource timePeriodResource = new TimePeriodResource(); timePeriodResource.setId(id); timePeriodResource.setBegDate(new Date()); MessageResource responseResource = new MessageResource(MessageType.INFO, "TimePeriod Updated"); String request = getJson(timePeriodResource, true); String response = getJson(responseResource, false); mockMvc.perform(put("/timeperiods/{id}", id) .contentType(MediaType.APPLICATION_JSON) .content(request)) .andExpect(status().isOk()) .andExpect(content().string(response)); verify(facade).updateResource(id, timePeriodResource); }