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