BenefitController extends BaseController implements CrudController<BenefitResource, BenefitResource> { @Override @ResponseStatus(HttpStatus.CREATED) @RequestMapping(method = RequestMethod.POST) public BenefitResource createResource(@Valid @RequestBody final BenefitResource resource) { LOGGER.info("Creating new benefit:{}", resource); return facade.createResource(resource); }  @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(method = RequestMethod.GET) PagedResultResource<BenefitResource> getPagedResource(final PagedRequest<BenefitResource> request); @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(value = Request.ID, method = RequestMethod.GET) BenefitResource getResource(@PathVariable("id") final Long id); @Override @ResponseStatus(HttpStatus.CREATED) @RequestMapping(method = RequestMethod.POST) BenefitResource createResource(@Valid @RequestBody final BenefitResource resource); @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(value = Request.ID, method = RequestMethod.PUT) MessageResource updateResource(@PathVariable("id") final Long id,
			@Valid @RequestBody final BenefitResource resource); @Override @ResponseStatus(HttpStatus.NO_CONTENT) @RequestMapping(value = Request.ID, method = RequestMethod.DELETE) MessageResource removeResource(@PathVariable("id") final Long id);  }
@Test public void testCreateBenefit() throws Exception { BenefitResource benefitResource = new BenefitResource(); String request = getJson(benefitResource, true); String response = getJson(benefitResource, false); when(facade.createResource(any(BenefitResource.class))).thenReturn(benefitResource); mockMvc.perform(post("/benefits") .contentType(MediaType.APPLICATION_JSON) .content(request)) .andExpect(status().isCreated()) .andExpect(content().string(response)); verify(facade).createResource(benefitResource); }