@Override
  public List<String> pop(String queueName, int count, int timeout) {
    List<String> tasks = new ArrayList<>(count);
    if (!queues.containsKey(queueName)) {
      queues.put(queueName, new ConcurrentLinkedDeque<>());
    }
    for (int i = 0; i < count; ++i) {
      String entry = queues.get(queueName).pollFirst();
      if (entry != null) {
        tasks.add(entry);
      } else {
        break;
      }
    }
    if (!tasks.isEmpty()) {
      LOG.info("pop messages [{}] for queue [{}]", tasks, queueName);
    }
    return tasks;
  }
@Test
  public void testPop() {
    String queueName = "test-queue";
    String id = "abcd-1234-defg-5678";
    assertEquals(Collections.emptyList(), queueDao.pop(queueName, 2, 100));
    queueDao.pushIfNotExists(queueName, id, 123);
    assertEquals(Collections.singletonList(id), queueDao.pop(queueName, 2, 100));
    assertEquals(Collections.emptyList(), queueDao.pop(queueName, 2, 100));
  }