@Test
public void check_revoked_permissions_have_been_removed_from_resource() {

    // Given
    resourceSecured = new AbstractSecurityEnabledResource() {
        @Override
        public String getId() {
            return "id";
        }
    };
    HashSet<Permission> permissions = new HashSet<>();
    permissions.add(Permission.READ);
    permissions.add(Permission.ADMIN);
    resourceSecured.addPermissions(Subject.APPLICATION, "subject1", new HashSet<>(permissions));
    resourceSecured.addPermissions(Subject.APPLICATION, "subject3", new HashSet<>(permissions));
    // When
    service.revokePermission(resourceSecured, resourceSaver, Subject.APPLICATION, "subject1", "subject2");
    // Then
    verify(resourceSaver).save(resourceSecuredCaptor.capture());
    ISecurityEnabledResource resourceSecuredSaved = resourceSecuredCaptor.getValue();
    assertThat(resourceSecuredSaved.getPermissions(Subject.APPLICATION, "subject1")).containsExactly(Permission.READ);
    assertThat(resourceSecuredSaved.getPermissions(Subject.APPLICATION, "subject2")).isEmpty();
    assertThat(resourceSecuredSaved.getPermissions(Subject.APPLICATION, "subject3")).containsExactlyInAnyOrder(Permission.ADMIN, Permission.READ);
}