TimePeriodController extends BaseController implements CrudController<TimePeriodResource, TimePeriodResource> { @Override @ResponseStatus(HttpStatus.CREATED) @RequestMapping(method = RequestMethod.POST) @ApiOperation(value = "Create Person") public TimePeriodResource createResource(@Valid @RequestBody final TimePeriodResource resource) { LOG.info("Creating timePeriod: {}", resource); return facade.createResource(resource); }  @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 testCreateTimePeriod() throws Exception { TimePeriodResource timePeriodResource = new TimePeriodResource(); timePeriodResource.setBegDate(new Date()); String request = getJson(timePeriodResource, true); String response = getJson(timePeriodResource, false); when(facade.createResource(any(TimePeriodResource.class))).thenReturn(timePeriodResource); mockMvc.perform(post("/timeperiods") .contentType(MediaType.APPLICATION_JSON) .content(request)) .andExpect(status().isCreated()) .andExpect(content().string(response)); verify(facade).createResource(timePeriodResource); }