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