EnrolmentController extends BaseController implements CrudController<EnrolmentResource, EnrolmentResource> { @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(value = Request.ID, method = RequestMethod.PUT) @ApiOperation(value = "Update Enrolment", position = 2) public MessageResource updateResource(@PathVariable("id") final Long id, @Valid @RequestBody final EnrolmentResource resource) { LOG.info("Updating enrolment with id : {} , {} ", id, resource); facade.updateResource(id, resource); return new MessageResource(MessageType.INFO, "Enrolment Updated"); }  @Override @ResponseStatus(HttpStatus.CREATED) @RequestMapping(method = RequestMethod.POST) @ApiOperation(value = "Create Enrolment", position = 1) EnrolmentResource createResource(@Valid @RequestBody final EnrolmentResource enrolmentResource); @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(value = Request.ID, method = RequestMethod.PUT) @ApiOperation(value = "Update Enrolment", position = 2) MessageResource updateResource(@PathVariable("id") final Long id, 
			@Valid @RequestBody final EnrolmentResource resource); @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(value = Request.ID, method = RequestMethod.GET) @ApiOperation(value = "Get Enrolment", position = 3) EnrolmentResource getResource(@PathVariable("id") final Long id); @Override @ResponseStatus(HttpStatus.NO_CONTENT) @RequestMapping(value = Request.ID, method = RequestMethod.DELETE) @ApiOperation(value = "Remove Enrolment", position = 4) MessageResource removeResource(@PathVariable("id") final Long id); @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(method = RequestMethod.GET) @ApiOperation(value = "Get Enrolments") @ApiImplicitParams({ @ApiImplicitParam(name = "offset", value = "Offset", required = false, defaultValue = "0", dataType = "long", paramType = "query"), @ApiImplicitParam(name = "limit", value = "limit", required = false, defaultValue = "20", dataType = "long", paramType = "query"), @ApiImplicitParam(name = "resource", value = "resource", required = false, dataType = "EnrolmentResource", paramType = "EnrolmentResource") }) PagedResultResource<EnrolmentResource> getPagedResource(final PagedRequest<EnrolmentResource> request); @RequestMapping(value = "/{specofferId}/ratings") RatingResource getEnrolmentsRatingResource(@PathVariable("specofferId") long specofferId);  }
@Test public void testUpdateEnrolment() throws Exception { Long id = 1L; String docNum = "docNum"; EnrolmentResource enrolmentResource = new EnrolmentResource(); enrolmentResource.setId(id); enrolmentResource.setBegDate(new Date()); enrolmentResource.setDocNum(docNum); MessageResource responseResource = new MessageResource(MessageType.INFO, "Enrolment Updated"); String request = getJson(enrolmentResource, true); String response = getJson(responseResource, false); mockMvc.perform(put("/enrolments/{id}", id) .contentType(MediaType.APPLICATION_JSON) .content(request)) .andExpect(status().isOk()) .andExpect(content().string(response)); verify(facade).updateResource(id, enrolmentResource); }