@Override
  public Mono<DeleteAccountResponse> deleteAccount(final DeleteAccountRequest request) {
    final AuthenticatedDevice authenticatedDevice = AuthenticationUtil.requireAuthenticatedPrimaryDevice();

    return Mono.fromFuture(() -> accountsManager.getByAccountIdentifierAsync(authenticatedDevice.accountIdentifier()))
        .map(maybeAccount -> maybeAccount.orElseThrow(Status.UNAUTHENTICATED::asRuntimeException))
        .flatMap(account -> Mono.fromFuture(() -> accountsManager.delete(account, AccountsManager.DeletionReason.USER_REQUEST)))
        .thenReturn(DeleteAccountResponse.newBuilder().build());
  }
@Test
  void deleteAccount() {
    final Account account = mock(Account.class);

    when(accountsManager.getByAccountIdentifierAsync(AUTHENTICATED_ACI))
        .thenReturn(CompletableFuture.completedFuture(Optional.of(account)));

    when(accountsManager.delete(any(), any()))
        .thenReturn(CompletableFuture.completedFuture(null));

    final DeleteAccountResponse ignored =
        authenticatedServiceStub().deleteAccount(DeleteAccountRequest.newBuilder().build());

    verify(accountsManager).delete(account, AccountsManager.DeletionReason.USER_REQUEST);
  }