EnrolmentBenefitController extends BaseController implements CrudController<EnrolmentBenefitResource, EnrolmentBenefitResource> { @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(value = "/{enrolmentId}/benefits/{id}", method = RequestMethod.PUT) public MessageResource updateResource(@PathVariable("id") final Long id, @Valid @RequestBody final EnrolmentBenefitResource resource) { LOG.info("Updating enrolment benefit with id : {} , {} ", id, resource); facade.updateResource(id, resource); return new MessageResource(MessageType.INFO, "EnrolmentBenefit Updated"); }  @Override @ResponseStatus(HttpStatus.CREATED) @RequestMapping(value = "/{enrolmentId}/benefits", method = RequestMethod.POST) EnrolmentBenefitResource createResource(@Valid @RequestBody final EnrolmentBenefitResource resource); @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(value = "/{enrolmentId}/benefits/{id}", method = RequestMethod.PUT) MessageResource updateResource(@PathVariable("id") final Long id, 
			@Valid @RequestBody final EnrolmentBenefitResource resource); @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(value = "/{enrolmentId}/benefits/{id}", method = RequestMethod.GET) EnrolmentBenefitResource getResource(@PathVariable("id") final Long id); @Override @ResponseStatus(HttpStatus.NO_CONTENT) @RequestMapping(value = "/{enrolmentId}/benefits/{id}", method = RequestMethod.DELETE) MessageResource removeResource(@PathVariable("id") final Long id); @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(value = "/{enrolmentId}/benefits" , method = RequestMethod.GET) PagedResultResource<EnrolmentBenefitResource> getPagedResource(final PagedRequest<EnrolmentBenefitResource> request);  }
@Test public void testUpdateEnrolmentBenefit() throws Exception { Long id = 1L; Long enrolmentId = 2L; Long benefitId = 3L; EnrolmentBenefitResource resource = new EnrolmentBenefitResource(); resource.setId(id); resource.setEnrolmentId(enrolmentId); resource.setBenefitId(benefitId); MessageResource responseResource = new MessageResource( MessageType.INFO, "EnrolmentBenefit Updated"); String request = getJson(resource, true); String response = getJson(responseResource, false); mockMvc.perform( put("/enrolments/{enrolmentId}/benefits/{id}", enrolmentId, id) .contentType(MediaType.APPLICATION_JSON).content( request)).andExpect(status().isOk()) .andExpect(content().string(response)); verify(facade).updateResource(id, resource); }