EnrolmentEnrolmentSubjectController extends BaseController implements CrudController<EnrolmentEnrolmentSubjectResource, EnrolmentEnrolmentSubjectResource> { @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(value = "/{enrolmentId}/enrolmentsubjects/{id}", method = RequestMethod.PUT) public MessageResource updateResource(@PathVariable("id") final Long id, @Valid @RequestBody final EnrolmentEnrolmentSubjectResource resource) { LOG.info("Updating enrolment enrolment subject with id : {} , {} ", id, resource); facade.updateResource(id, resource); return new MessageResource(MessageType.INFO, "Enrolment Enrolment Subject Updated"); }  @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 testUpdateEnrolmentEnrolmentSubject() throws Exception { Long id = 5L; Long enrolmentId = 2L; Long enrolmentSubjectId = 6L; Long personEnrolmentSubjectId = 3L; Double mark = 4D; EnrolmentEnrolmentSubjectResource enrolmentEnrolmentSubjectResource = new EnrolmentEnrolmentSubjectResource(); enrolmentEnrolmentSubjectResource.setId(id); enrolmentEnrolmentSubjectResource.setEnrolmentSubjectId(enrolmentSubjectId); enrolmentEnrolmentSubjectResource.setEnrolmentId(enrolmentId); enrolmentEnrolmentSubjectResource.setPersonEnrolmentSubjectId(personEnrolmentSubjectId); enrolmentEnrolmentSubjectResource.setMark(mark); MessageResource responseResource = new MessageResource( MessageType.INFO, "Enrolment Enrolment Subject Updated"); String request = getJson(enrolmentEnrolmentSubjectResource, true); String response = getJson(responseResource, false); mockMvc.perform( put( "/enrolments/{enrolmentId}/enrolmentsubjects/{enrolmentEnrolmentSubjectId}", enrolmentId, id).contentType(MediaType.APPLICATION_JSON) .content(request)).andExpect(status().isOk()) .andExpect(content().string(response)); verify(facade).updateResource(id, enrolmentEnrolmentSubjectResource); }