You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by en...@apache.org on 2020/10/11 18:58:14 UTC
[sling-org-apache-sling-jcr-jackrabbit-usermanager] branch master
updated: Only one method invocation is expected when testing checked
exceptions
This is an automated email from the ASF dual-hosted git repository.
enorman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-jackrabbit-usermanager.git
The following commit(s) were added to refs/heads/master by this push:
new 4581b52 Only one method invocation is expected when testing checked exceptions
4581b52 is described below
commit 4581b5286faccdd4778ca93cb17093c9e3eefbb7
Author: Eric Norman <en...@apache.org>
AuthorDate: Sun Oct 11 11:58:03 2020 -0700
Only one method invocation is expected when testing checked exceptions
---
.../it/AuthorizablePrivilegesInfoIT.java | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)
diff --git a/src/test/java/org/apache/sling/jcr/jackrabbit/usermanager/it/AuthorizablePrivilegesInfoIT.java b/src/test/java/org/apache/sling/jcr/jackrabbit/usermanager/it/AuthorizablePrivilegesInfoIT.java
index 419c235..939a4d0 100644
--- a/src/test/java/org/apache/sling/jcr/jackrabbit/usermanager/it/AuthorizablePrivilegesInfoIT.java
+++ b/src/test/java/org/apache/sling/jcr/jackrabbit/usermanager/it/AuthorizablePrivilegesInfoIT.java
@@ -32,6 +32,7 @@ import java.util.Map;
import java.util.concurrent.atomic.AtomicLong;
import javax.inject.Inject;
+import javax.jcr.AccessDeniedException;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
import javax.jcr.SimpleCredentials;
@@ -420,13 +421,13 @@ public class AuthorizablePrivilegesInfoIT extends UserManagerTestSupport {
// verify that the user can not add nested property
propsMap = new HashMap<>();
propsMap.put("nested/prop2", "value2");
+ updateUser.updateUser(user1Session, user2.getID(), propsMap, new ArrayList<>());
+ updateGroup.updateGroup(user1Session, group1.getID(), propsMap, new ArrayList<>());
+ assertTrue("Expected pending changes in the jcr session", user1Session.hasPendingChanges());
try {
- updateUser.updateUser(user1Session, user2.getID(), propsMap, new ArrayList<>());
- updateGroup.updateGroup(user1Session, group1.getID(), propsMap, new ArrayList<>());
- assertTrue("Expected pending changes in the jcr session", user1Session.hasPendingChanges());
user1Session.save();
- fail("Expected AccessDenied exception when adding nested property");
- } catch (RepositoryException e) {
+ fail("Expected AccessDeniedException when adding nested property");
+ } catch (AccessDeniedException e) {
// expected
user1Session.refresh(false);
}
@@ -476,13 +477,13 @@ public class AuthorizablePrivilegesInfoIT extends UserManagerTestSupport {
}
// verify that the user can not add nested property
propsMap.put("nested/prop2", "value2");
+ updateUser.updateUser(user1Session, user2.getID(), propsMap, new ArrayList<>());
+ updateGroup.updateGroup(user1Session, group1.getID(), propsMap, new ArrayList<>());
+ assertTrue("Expected pending changes in the jcr session", user1Session.hasPendingChanges());
try {
- updateUser.updateUser(user1Session, user2.getID(), propsMap, new ArrayList<>());
- updateGroup.updateGroup(user1Session, group1.getID(), propsMap, new ArrayList<>());
- assertTrue("Expected pending changes in the jcr session", user1Session.hasPendingChanges());
user1Session.save();
- fail("Expected AccessDenied exception when adding nested property");
- } catch (RepositoryException e) {
+ fail("Expected AccessDeniedException when adding nested property");
+ } catch (AccessDeniedException e) {
// expected
user1Session.refresh(false);
}