public boolean clearPresence(final UUID accountUuid, final byte deviceId, final DisplacedPresenceListener listener) {
    final String presenceKey = getPresenceKey(accountUuid, deviceId);
    if (displacementListenersByPresenceKey.remove(presenceKey, listener)) {
      return clearPresence(presenceKey);
    } else {
      displacementListenerAlreadyRemovedCounter.increment();
      return false;
    }
  }
@Test
  void testClearPresence() {
    final UUID accountUuid = UUID.randomUUID();
    final byte deviceId = 1;

    assertFalse(clientPresenceManager.isPresent(accountUuid, deviceId));

    clientPresenceManager.setPresent(accountUuid, deviceId, NO_OP);
    assertFalse(clientPresenceManager.clearPresence(accountUuid, deviceId,
        ignored -> fail("this listener should never be called")));
    assertTrue(clientPresenceManager.clearPresence(accountUuid, deviceId, NO_OP));

    clientPresenceManager.setPresent(accountUuid, deviceId, NO_OP);
    REDIS_CLUSTER_EXTENSION.getRedisCluster().useCluster(
        connection -> connection.sync().set(ClientPresenceManager.getPresenceKey(accountUuid, deviceId),
            UUID.randomUUID().toString()));

    assertFalse(clientPresenceManager.clearPresence(accountUuid, deviceId, NO_OP));
  }