EnrolmentStatusController extends BaseController implements CrudController<EnrolmentStatusResource, EnrolmentStatusResource> { @Override @ResponseStatus(HttpStatus.CREATED) @RequestMapping(value = "/{enrolmentId}/statuses", method = RequestMethod.POST) public EnrolmentStatusResource createResource(@Valid @RequestBody final EnrolmentStatusResource enrolmentResource) { LOG.info("Creating enrolment status : {} ", enrolmentResource); return facade.createResource(enrolmentResource); }  @Override @ResponseStatus(HttpStatus.CREATED) @RequestMapping(value = "/{enrolmentId}/statuses", method = RequestMethod.POST) EnrolmentStatusResource createResource(@Valid @RequestBody final EnrolmentStatusResource enrolmentResource); @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(value = "/{enrolmentId}/statuses/{id}", method = RequestMethod.PUT) MessageResource updateResource(@PathVariable("id") final Long id, 
			@Valid @RequestBody final EnrolmentStatusResource resource); @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(value = "/{enrolmentId}/statuses/{id}", method = RequestMethod.GET) EnrolmentStatusResource getResource(@PathVariable("id") final Long id); @Override @ResponseStatus(HttpStatus.NO_CONTENT) @RequestMapping(value = "/{enrolmentId}/statuses/{id}", method = RequestMethod.DELETE) MessageResource removeResource(@PathVariable("id") final Long id); @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(value = "/{enrolmentId}/statuses", method = RequestMethod.GET) PagedResultResource<EnrolmentStatusResource> getPagedResource(final PagedRequest<EnrolmentStatusResource> request);  }
@Test public void testCreateEnrolmentStatus() throws Exception { Long id = 1L; Long enrolmentId = 2L; EnrolmentStatusResource enrolmentResource = new EnrolmentStatusResource(); enrolmentResource.setId(id); enrolmentResource.setEnrolmentId(enrolmentId); String request = getJson(enrolmentResource, true); String response = getJson(enrolmentResource, false); when(facade.createResource(any(EnrolmentStatusResource.class))) .thenReturn(enrolmentResource); mockMvc.perform( post("/enrolments/{enrolmentId}/statuses", enrolmentId) .contentType(MediaType.APPLICATION_JSON).content( request)).andExpect(status().isCreated()) .andExpect(content().string(response)); verify(facade).createResource(enrolmentResource); }