public CompletableFuture<Account> clearUsernameHash(final Account account) {
    return redisDeleteAsync(account)
        .thenCompose(ignored -> updateWithRetriesAsync(
            account,
            a -> true,
            accounts::clearUsernameHash,
            () -> accounts.getByAccountIdentifierAsync(account.getUuid()).thenApply(Optional::orElseThrow),
            AccountChangeValidator.USERNAME_CHANGE_VALIDATOR,
            MAX_UPDATE_ATTEMPTS))
        .whenComplete((updatedAccount, throwable) -> {
          if (throwable == null) {
            // Make a best effort to clear any stale data that may have been cached while this operation was in progress
            redisDeleteAsync(updatedAccount);
          }
        });
  }
@Test
  void testClearUsernameHash() {
    when(accounts.clearUsernameHash(any()))
        .thenReturn(CompletableFuture.completedFuture(null));

    Account account = AccountsHelper.generateTestAccount("+18005551234", UUID.randomUUID(), UUID.randomUUID(), new ArrayList<>(), new byte[UnidentifiedAccessUtil.UNIDENTIFIED_ACCESS_KEY_LENGTH]);
    account.setUsernameHash(USERNAME_HASH_1);
    accountsManager.clearUsernameHash(account).join();
    verify(accounts).clearUsernameHash(eq(account));
  }