source code formatting.
[utils] / security / src / test / java / org / wamblee / security / authorization / TestUserAccessor.java
index 02e090206c87e7736ffee7555400030843c850a4..b4d8909781da1a8a7f18b3434e6f6dce2adcfba0 100644 (file)
@@ -1,24 +1,24 @@
 /*
  * Copyright 2005 the original author or authors.
- * 
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.wamblee.security.authorization;
 
 import junit.framework.TestCase;
 
 import org.wamblee.security.encryption.Md5HexMessageDigester;
+
 import org.wamblee.usermgt.Group;
 import org.wamblee.usermgt.InMemoryGroupSet;
 import org.wamblee.usermgt.InMemoryUserSet;
@@ -30,37 +30,59 @@ import org.wamblee.usermgt.UserAdministrationImpl;
 import org.wamblee.usermgt.UserMgtException;
 import org.wamblee.usermgt.UserMgtException.Reason;
 
+
 /**
- * User access that always returns a user that belongs to
- * a fixed group. 
+ * User access that always returns a user that belongs to a fixed group.
  *
  * @author Erik Brakkee
  */
 public class TestUserAccessor implements UserAccessor {
-    
-    private static final String USER = "erik"; 
+    /**
+     * DOCUMENT ME!
+     */
+    private static final String USER = "erik";
+
+    /**
+     * DOCUMENT ME!
+     */
     private static final String PASSWORD = "abc123";
+
+    /**
+     * DOCUMENT ME!
+     */
     private static final String GROUP = "users";
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.wamblee.usermgt.UserAccessor#getCurrentUser()
      */
+    /**
+     * DOCUMENT ME!
+     *
+     * @return DOCUMENT ME!
+     *
+     * @throws RuntimeException DOCUMENT ME!
+     */
     public User getCurrentUser() {
-        UserAdministration admin = new UserAdministrationImpl(
-                new InMemoryUserSet(    new RegexpNameValidator(RegexpNameValidator.PASSWORD_PATTERN, Reason.INVALID_PASSWORD, "Password must contain at least 6 characters"),
-                        new Md5HexMessageDigester()), new InMemoryGroupSet(),
-                new RegexpNameValidator(RegexpNameValidator.ID_PATTERN, Reason.INVALID_USERNAME, "Invalid user"), 
-                new RegexpNameValidator(RegexpNameValidator.ID_PATTERN, Reason.INVALID_GROUPNAME, "Invalid group")
-        );
+        UserAdministration admin = new UserAdministrationImpl(new InMemoryUserSet(
+                    new RegexpNameValidator(
+                        RegexpNameValidator.PASSWORD_PATTERN,
+                        Reason.INVALID_PASSWORD,
+                        "Password must contain at least 6 characters"),
+                    new Md5HexMessageDigester()), new InMemoryGroupSet(),
+                new RegexpNameValidator(RegexpNameValidator.ID_PATTERN,
+                    Reason.INVALID_USERNAME, "Invalid user"),
+                new RegexpNameValidator(RegexpNameValidator.ID_PATTERN,
+                    Reason.INVALID_GROUPNAME, "Invalid group"));
+
         try {
             Group group = admin.createGroup(GROUP);
+
             return admin.createUser(USER, PASSWORD, group);
         } catch (UserMgtException e) {
             TestCase.fail(e.getMessage());
             throw new RuntimeException(e);
         }
     }
-
 }