@Override
  public String toString() {
    String str = null;

    if (allAllowed) {
      str = "All users are allowed";
    }
    else if (users.isEmpty() && groups.isEmpty()) {
      str = "No users are allowed";
    }
    else {
      String usersStr = null;
      String groupsStr = null;
      if (!users.isEmpty()) {
        usersStr = users.toString();
      }
      if (!groups.isEmpty()) {
        groupsStr = groups.toString();
      }

      if (!users.isEmpty() && !groups.isEmpty()) {
        str = "Users " + usersStr + " and members of the groups "
            + groupsStr + " are allowed";
      }
      else if (!users.isEmpty()) {
        str = "Users " + usersStr + " are allowed";
      }
      else {// users is empty array and groups is nonempty
        str = "Members of the groups "
            + groupsStr + " are allowed";
      }
    }

    return str;
  }
@Test
  public void testAclString() {
    AccessControlList acl;

    acl = new AccessControlList("*");
    assertThat(acl.toString()).isEqualTo("All users are allowed");
    validateGetAclString(acl);

    acl = new AccessControlList(" ");
    assertThat(acl.toString()).isEqualTo("No users are allowed");

    acl = new AccessControlList("user1,user2");
    assertThat(acl.toString()).isEqualTo("Users [user1, user2] are allowed");
    validateGetAclString(acl);

    acl = new AccessControlList("user1,user2 ");// with space
    assertThat(acl.toString()).isEqualTo("Users [user1, user2] are allowed");
    validateGetAclString(acl);

    acl = new AccessControlList(" group1,group2");
    assertThat(acl.toString()).isEqualTo(
        "Members of the groups [group1, group2] are allowed");
    validateGetAclString(acl);

    acl = new AccessControlList("user1,user2 group1,group2");
    assertThat(acl.toString()).isEqualTo(
        "Users [user1, user2] and " +
        "members of the groups [group1, group2] are allowed");
    validateGetAclString(acl);
  }