PersonEnrolmentSubjectController extends BaseController implements CrudController<PersonEnrolmentSubjectResource, PersonEnrolmentSubjectResource> { @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(value = "/{personId}/enrolmentsubjects/{personEnrolmentSubjectId}", method = RequestMethod.PUT) @ApiOperation(value = "Update PersonName", position = 3) public MessageResource updateResource(@PathVariable("personEnrolmentSubjectId") final Long id, @Valid @RequestBody final PersonEnrolmentSubjectResource resource) { LOG.info("Updating personEnrolmentSubject with id: {}, {}", id, resource); facade.updateResource(id, resource); return new MessageResource(MessageType.INFO, "Person Enrolment Subject Updated"); }  @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 testUpdatePersonEnrolmentSubject() throws Exception { Long personId = 2L; Long id = 1L; PersonEnrolmentSubjectResource personEnrolmentSubjectResource = new PersonEnrolmentSubjectResource(); personEnrolmentSubjectResource.setId(id); personEnrolmentSubjectResource.setPersonId(personId); MessageResource responseResource = new MessageResource(MessageType.INFO, "Person Enrolment Subject Updated"); String request = getJson(personEnrolmentSubjectResource, true); String response = getJson(responseResource, false); mockMvc.perform( put("/persons/{personId}/enrolmentsubjects/{enrolmentSubjectId}", personId, id).contentType(MediaType.APPLICATION_JSON).content( request)).andExpect(status().isOk()).andExpect(content().string(response)); verify(facade).updateResource(id, personEnrolmentSubjectResource); }