PersonAwardController extends BaseController implements CrudController<PersonAwardResource, PersonAwardResource> { @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(value = "/{personId}/awards/{personAwardId}", method = RequestMethod.GET) @ApiOperation(value = "Get PersonAward by id", position = 3) public PersonAwardResource getResource(@PathVariable("personAwardId") final Long personAwardId) { LOG.info("Retrieving personAward with id: {}", personAwardId); return facade.getResource(personAwardId); }  @Override @ResponseStatus(HttpStatus.CREATED) @RequestMapping(value = "/{personId}/awards", method = RequestMethod.POST) @ApiOperation(value = "Create PersonAward") PersonAwardResource createResource(@Valid @RequestBody final PersonAwardResource personAwardResource); @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(value = "/{personId}/awards/{personAwardId}", method = RequestMethod.PUT) @ApiOperation(value = "Update PersonAward") MessageResource updateResource(@PathVariable("personAwardId") final Long personAwardId,
 			@Valid @RequestBody final PersonAwardResource personAwardResource); @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(value = "/{personId}/awards/{personAwardId}", method = RequestMethod.GET) @ApiOperation(value = "Get PersonAward by id", position = 3) PersonAwardResource getResource(@PathVariable("personAwardId") final Long personAwardId); @Override @ResponseStatus(HttpStatus.NO_CONTENT) @RequestMapping(value = "/{personId}/awards/{personAwardId}", method = RequestMethod.DELETE) @ApiOperation(value = "Delete PersonAward", position = 4) MessageResource removeResource(@PathVariable("personAwardId") final Long personAwardId); @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(value = "/{personId}/awards", method = RequestMethod.GET) @ApiOperation(value = "Get PersonAwards") PagedResultResource<PersonAwardResource> getPagedResource(final PagedRequest<PersonAwardResource> request);  }
@Test public void testGetSpecoffer() throws Exception { Long id = 1L; Long personId = 1L; PersonAwardResource personAwardResource = new PersonAwardResource(); String response = getJson(personAwardResource, false); when(facade.getResource(anyLong())).thenReturn(personAwardResource); mockMvc.perform(get("/persons/{personId}/awards/{id}", personId, id)) .andExpect(status().isOk()) .andExpect(content().string(response)); verify(facade).getResource(id); }
@Test(expected = AccessDeniedException.class) public void testGetResourceWithAccessDeniedException() throws Exception { Long id = 1L; Long personId = 2L; doThrow(AccessDeniedException.class).when(facade).getResource(anyLong()); mockMvc.perform(get("/persons/{personId}/awards/{id}", personId, id)); verify(facade).getResource(id); }