public void createUser(String username, String password, String realm, Encryption encryption, List<String> userGroups, List<String> algorithms) {
      if (users.containsKey(username)) {
         throw MSG.userToolUserExists(username);
      }
      realm = checkRealm(realm);
      users.put(username, Encryption.CLEAR.equals(encryption) ? password : encryptPassword(username, realm, password, algorithms));
      groups.put(username, userGroups != null ? String.join(",", userGroups) : "");
      store(realm, encryption);
   }
@Test
   public void testUserToolEncrypted() throws Exception {
      UserTool userTool = new UserTool(serverDirectory.getAbsolutePath());
      userTool.createUser("user", "password", UserTool.DEFAULT_REALM_NAME, UserTool.Encryption.ENCRYPTED, Collections.singletonList("admin"), null);
      Properties users = loadProperties("users.properties");
      assertEquals(1, users.size());
      assertPassword("password", users.getProperty("user"));
      Properties groups = loadProperties("groups.properties");
      assertEquals(1, groups.size());
      assertEquals("admin", groups.getProperty("user"));
   }