AdminItemResource extends BaseResource { @DELETE @Timed @Path("/{itemId}") public Response delete( @RestrictedTo({Authority.ROLE_ADMIN}) User adminUser, @PathParam("itemId") Long itemId, AdminDeleteEntityDto deleteEntityRequest) { Optional<Item> item = itemReadService.getById(itemId); ResourceAsserts.assertPresent(item, "item"); Item persistentItem = item.get(); persistentItem.setDeleted(true); persistentItem.setReasonForDelete(deleteEntityRequest.getReason()); persistentItem = itemReadService.saveOrUpdate(item.get()); Representation representation = new AdminItemRepresentation().get(persistentItem); return ok(representation); }  @POST @Timed Response create(
    @RestrictedTo({Authority.ROLE_ADMIN})
    User adminUser,
    AdminCreateItemDto createItemRequest); @GET @Timed @CacheControl(maxAge = 6, maxAgeUnit = TimeUnit.HOURS) Response retrieveAllByPage(
    @RestrictedTo({Authority.ROLE_ADMIN})
    User adminUser,
    @QueryParam("ps") Optional<String> rawPageSize,
    @QueryParam("pn") Optional<String> rawPageNumber); @PUT @Timed @Path("/{itemId}") Response update(
    @RestrictedTo({Authority.ROLE_ADMIN})
    User adminUser,
    @PathParam("itemId") Long itemId,
    AdminUpdateItemDto updateItemRequest); @DELETE @Timed @Path("/{itemId}") Response delete(
    @RestrictedTo({Authority.ROLE_ADMIN})
    User adminUser,
    @PathParam("itemId") Long itemId,
    AdminDeleteEntityDto deleteEntityRequest); void setItemReadService(ItemReadService itemReadService);  }
@Test public void adminDeleteItemAsHalJson() throws Exception { AdminDeleteEntityDto deleteItemRequest = new AdminDeleteEntityDto(); deleteItemRequest.setReason("No longer available"); String actualResponse = configureAsClient("/admin/item/1") .accept(HalMediaType.APPLICATION_HAL_JSON) .entity(deleteItemRequest, MediaType.APPLICATION_JSON_TYPE) .delete(String.class); FixtureAsserts.assertStringMatchesJsonFixture("DeleteItem by admin response render to HAL+JSON",actualResponse, "/fixtures/hal/item/expected-admin-delete-item.json"); }