@Test
public void processUnacksTest() {

	final String queueName = "process_unacks_test";
	// Count of messages in the queue(s)
	final int count = 10;
	// Number of messages to process acks for
	final int unackedCount = 4;
	// A secondary queue to make sure we don't accidentally process other queues
	final String otherQueueName = "process_unacks_test_other_queue";
	// Create testing queue with some messages (but not all) that will be popped/acked.
	for(int i = 0; i < count; i++) {
		int offset = 0;
		if(i >= unackedCount){ offset = 1_000_000; }
		dao.push(queueName, "unack-" + i, offset);
	}
	// Create a second queue to make sure that unacks don't occur for it
	for(int i = 0; i < count; i++) {
		dao.push(otherQueueName, "other-" + i, 0);
	}
	// Poll for first batch of messages (should be equal to unackedCount)
	List<Message> polled = dao.pollMessages(queueName, 100, 10_000);
	assertNotNull(polled);
	assertFalse(polled.isEmpty());
	assertEquals(unackedCount, polled.size());
	// Poll messages from the other queue so we know they don't get unacked later
	dao.pollMessages(otherQueueName, 100, 10_000);
	// Ack one of the polled messages
	assertTrue(dao.ack(queueName, "unack-1"));
	// Should have one less un-acked popped message in the queue
	Long uacked = dao.queuesDetailVerbose().get(queueName).get("a").get("uacked");
	assertNotNull(uacked);
	assertEquals(uacked.longValue(), unackedCount - 1);
	// Process unacks
	dao.processUnacks(queueName);
	// Check uacks for both queues after processing
	Map<String, Map<String, Map<String, Long>>> details = dao.queuesDetailVerbose();
	uacked = details.get(queueName).get("a").get("uacked");
	assertNotNull(uacked);
	assertEquals("There should be no unacked messages", uacked.longValue(), 0);
	Long otherUacked = details.get(otherQueueName).get("a").get("uacked");
	assertNotNull(otherUacked);
	assertEquals("Other queue should have unacked messages", otherUacked.longValue(), count);
	Long size = dao.queuesDetail().get(queueName);
	assertNotNull(size);
	assertEquals(size.longValue(), count - 1);
}