diff --git a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/MockAuthenticationUtilHelper.java b/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/MockAuthenticationUtilHelper.java
index d527117b09..0f934d248d 100644
--- a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/MockAuthenticationUtilHelper.java
+++ b/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/MockAuthenticationUtilHelper.java
@@ -53,6 +53,23 @@ public class MockAuthenticationUtilHelper
return mockAuthenticationUtil;
}
+ /**
+ * Create a Mockito mock AuthenticationUtil
that executes all methods assuming the user has permission.
+ *
+ * @param adminUserName The name of the default admin user.
+ * @param fullyAuthenticatedUser The name of the user that last authenticated.
+ * @param systemUserName The name of the system user.
+ * @return The new mock.
+ */
+ public static AuthenticationUtil create(String adminUserName, String fullyAuthenticatedUser, String systemUserName)
+ {
+ AuthenticationUtil mockAuthenticationUtil = mock(AuthenticationUtil.class);
+
+ setup(mockAuthenticationUtil, adminUserName, fullyAuthenticatedUser, systemUserName);
+
+ return mockAuthenticationUtil;
+ }
+
/**
* Set up a Mockito mock AuthenticationUtil
so that it executes all methods assuming the user has
* permissions. If the mock is asked for details about the user then it assumes the user is "admin".
@@ -63,6 +80,24 @@ public class MockAuthenticationUtilHelper
*/
@SuppressWarnings("unchecked")
protected static void setup(AuthenticationUtil mockAuthenticationUtil)
+ {
+ setup(mockAuthenticationUtil, "admin", "admin", "admin");
+ }
+
+ /**
+ * Set up a Mockito mock AuthenticationUtil
so that it executes all methods assuming the user has
+ * permissions.
+ *
+ * TODO: Change this method to private and this class to be a factory. + * + * @param mockAuthenticationUtil The mock to initialise. + * @param adminUserName The name of the default admin user. + * @param fullyAuthenticatedUser The name of the user that last authenticated. + * @param systemUserName The name of the system user. + */ + @SuppressWarnings("unchecked") + protected static void setup(AuthenticationUtil mockAuthenticationUtil, String adminUserName, + String fullyAuthenticatedUser, String systemUserName) { reset(mockAuthenticationUtil); @@ -93,7 +128,8 @@ public class MockAuthenticationUtilHelper }).when(mockAuthenticationUtil).