AdminRoleResource extends BaseResource { @DELETE @Timed @Path("/{roleId}") public Response delete( @RestrictedTo({Authority.ROLE_ADMIN}) User adminUser, @PathParam("roleId") Long roleId, AdminDeleteEntityDto deleteEntityRequest) { Optional<Role> role = roleReadService.getById(roleId); ResourceAsserts.assertPresent(role,"role"); Role persistentRole = role.get(); persistentRole.setDeleted(true); persistentRole.setReasonForDelete(deleteEntityRequest.getReason()); persistentRole = roleReadService.saveOrUpdate(role.get()); Representation representation = new AdminRoleRepresentation().get(persistentRole); return ok(representation); }  @POST @Timed Response create(
    @RestrictedTo({Authority.ROLE_ADMIN})
    User adminUser,
    AdminCreateRoleDto createRoleRequest); @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("/{roleId}") Response update(
    @RestrictedTo({Authority.ROLE_ADMIN})
    User adminUser,
    @PathParam("roleId") Long roleId,
    AdminUpdateRoleDto updateRoleRequest); @DELETE @Timed @Path("/{roleId}") Response delete(
    @RestrictedTo({Authority.ROLE_ADMIN})
    User adminUser,
    @PathParam("roleId") Long roleId,
    AdminDeleteEntityDto deleteEntityRequest); void setRoleReadService(RoleReadService roleReadService);  }
@Test public void adminDeleteRoleAsHalJson() throws Exception { AdminDeleteEntityDto deleteRoleRequest = new AdminDeleteEntityDto(); deleteRoleRequest.setReason("At role request"); String actualResponse = configureAsClient("/admin/role/1") .accept(HalMediaType.APPLICATION_HAL_JSON) .entity(deleteRoleRequest, MediaType.APPLICATION_JSON_TYPE) .delete(String.class); FixtureAsserts.assertStringMatchesJsonFixture("DeleteRole by admin response render to HAL+JSON",actualResponse, "/fixtures/hal/role/expected-admin-delete-role.json"); }