SpecOffetTypeController extends BaseController implements PagedController<SpecOfferTypeResource, SpecOfferTypeResource> { @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(value = Request.ID, method = RequestMethod.GET) @ApiOperation(value = "Get spec offer type by id") public SpecOfferTypeResource getResource(@PathVariable("id") final Long id) { return facade.getResource(id); }  @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(method = RequestMethod.GET) @ApiOperation(value = "Get's All SpecOfferTypes", position = 5) PagedResultResource<SpecOfferTypeResource> getPagedResource(@Limit(defaultValue = "40") final PagedRequest<SpecOfferTypeResource> request); @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(value = Request.ID, method = RequestMethod.GET) @ApiOperation(value = "Get spec offer type by id") SpecOfferTypeResource getResource(@PathVariable("id") final Long id);  }
@Test(expected = AccessDeniedException.class) public void testGetResourceWithAccessDeniedException() throws Exception { Long id = 1L; doThrow(AccessDeniedException.class).when(facade).getResource(anyLong()); mockMvc.perform(get("/specoffers/types/{id}", id)); verify(facade).getResource(id); }