PersonEnrolmentSubjectController extends BaseController implements CrudController<PersonEnrolmentSubjectResource, PersonEnrolmentSubjectResource> { @Override @ResponseStatus(HttpStatus.CREATED) @RequestMapping(value = "/{personId}/enrolmentsubjects", method = RequestMethod.POST) @ApiOperation(value = "Create Enrolment Subject", position = 2) public PersonEnrolmentSubjectResource createResource(@Valid @RequestBody final PersonEnrolmentSubjectResource resource) { LOG.info("Creating Enrolment Subject: {}", resource); return facade.createResource(resource); }  @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(value = "/{personId}/enrolmentsubjects", method = RequestMethod.GET) @ApiOperation(value = "Get Person Enrolment Subjects") PagedResultResource<PersonEnrolmentSubjectResource> getPagedResource(final PagedRequest<PersonEnrolmentSubjectResource> request); @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(value = "/{personId}/enrolmentsubjects/{personEnrolmentSubjectId}", method = RequestMethod.GET) @ApiOperation(value = "Get Person Enrolment Subjects by id", position = 1) PersonEnrolmentSubjectResource getResource(@PathVariable("personEnrolmentSubjectId") final Long id); @Override @ResponseStatus(HttpStatus.CREATED) @RequestMapping(value = "/{personId}/enrolmentsubjects", method = RequestMethod.POST) @ApiOperation(value = "Create Enrolment Subject", position = 2) PersonEnrolmentSubjectResource createResource(@Valid @RequestBody final PersonEnrolmentSubjectResource resource); @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(value = "/{personId}/enrolmentsubjects/{personEnrolmentSubjectId}", method = RequestMethod.PUT) @ApiOperation(value = "Update PersonName", position = 3) MessageResource updateResource(@PathVariable("personEnrolmentSubjectId") final Long id,
			@Valid @RequestBody final PersonEnrolmentSubjectResource resource); @Override @ResponseStatus(HttpStatus.NO_CONTENT) @RequestMapping(value = "/{personId}/enrolmentsubjects/{personEnrolmentSubjectId}", method = RequestMethod.DELETE) @ApiOperation(value = "Delete Person Enrolment Subject", position = 4) MessageResource removeResource(@PathVariable("personEnrolmentSubjectId") final Long id);  }
@Test public void testCreatePersonEnrolmentSubject() throws Exception { Long personId = 1L; Long id = 2L; PersonEnrolmentSubjectResource personEnrolmentSubjectResource = new PersonEnrolmentSubjectResource(); personEnrolmentSubjectResource.setId(id); String request = getJson(personEnrolmentSubjectResource, true); String response = getJson(personEnrolmentSubjectResource, false); when(facade.createResource(any(PersonEnrolmentSubjectResource.class))).thenReturn(personEnrolmentSubjectResource); mockMvc.perform(post("/persons/{personId}/enrolmentsubjects", personId).contentType(MediaType.APPLICATION_JSON).content(request)) .andExpect(status().isCreated()).andExpect(content().string(response)); verify(facade).createResource(personEnrolmentSubjectResource); }