  @Test
  public void dropTailWhenFull_dropTailStrategy() throws InterruptedException {

    AbstractSizeBoundedQueue queue = newQueue(OverflowStrategy.dropTail);
    CountDownLatch countDown = new CountDownLatch(1);

    for (int i = 0; i < queue.maxSize; i++) {
      MessagePromise<Integer> next = newPromise(i);
      queue.offer(next);
      if (i == queue.maxSize - 1) {
        next.addListener(future -> {
          assertEquals(queue.maxSize - 1, getKey(future));
          countDown.countDown();
        });
      }
    }
    MessagePromise<Integer> overflow = newPromise(queue.maxSize);
    queue.offer(overflow);
    countDown.await();

    Object[] ids = collectKeys(queue);
    assertArrayEquals(new Object[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 16}, ids);
  }