@Override
  public Mono<ClearRegistrationLockResponse> clearRegistrationLock(final ClearRegistrationLockRequest 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.updateAsync(account,
            a -> a.setRegistrationLock(null, null))))
        .map(ignored -> ClearRegistrationLockResponse.newBuilder().build());
  }
@Test
  void clearRegistrationLock() {
    final Account account = mock(Account.class);

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

    final ClearRegistrationLockResponse ignored =
        authenticatedServiceStub().clearRegistrationLock(ClearRegistrationLockRequest.newBuilder().build());

    verify(account).setRegistrationLock(null, null);
  }