public void setUsers(List<?> users) {
        userPasswords.clear();
        userGroups.clear();
        for (Iterator<?> it = users.iterator(); it.hasNext();) {
            AuthenticationUser user = (AuthenticationUser)it.next();
            userPasswords.put(user.getUsername(), user.getPassword());
            Set<Principal> groups = new HashSet<Principal>();
            if (user.getGroups() != null) {
                StringTokenizer iter = new StringTokenizer(user.getGroups(), ",");
                while (iter.hasMoreTokens()) {
                    String name = iter.nextToken().trim();
                    groups.add(new GroupPrincipal(name));
                }
            }
            userGroups.put(user.getUsername(), groups);
        }
    }
@Test
    public void testSetUsers() {
        AuthenticationUser alice = new AuthenticationUser("alice", "password", "group1");
        AuthenticationUser bob = new AuthenticationUser("bob", "security", "group2");
        SimpleAuthenticationPlugin authenticationPlugin = new SimpleAuthenticationPlugin();
        authenticationPlugin.setUsers(Arrays.asList(alice, bob));
        
        assertFalse(authenticationPlugin.isAnonymousAccessAllowed());
        
        Map<String, String> userPasswords = authenticationPlugin.getUserPasswords();
        assertEquals(2, userPasswords.size());
        assertEquals("password", userPasswords.get("alice"));
        assertEquals("security", userPasswords.get("bob"));
        
        Map<String, Set<Principal>> userGroups = authenticationPlugin.getUserGroups();
        assertEquals(2, userGroups.size());
        
        Set<Principal> aliceGroups = userGroups.get("alice");
        assertNotNull(aliceGroups);
        assertEquals(1, aliceGroups.size());
        assertEquals("group1", aliceGroups.iterator().next().getName());
        
        Set<Principal> bobGroups = userGroups.get("bob");
        assertNotNull(bobGroups);
        assertEquals(1, bobGroups.size());
        assertEquals("group2", bobGroups.iterator().next().getName());
    }