@Test
public void testInQueue() {

    PriorityQueue<ExponentialBackoff> queue = new PriorityQueue<ExponentialBackoff>();
    ExponentialBackoff backoff1 = new ExponentialBackoff(params);
    backoff.trackFailure();
    backoff.trackFailure();
    backoff1.trackFailure();
    backoff1.trackFailure();
    backoff1.trackFailure();
    queue.offer(backoff);
    queue.offer(backoff1);
    assertEquals(queue.poll(), backoff); // The one with soonest retry time
    assertEquals(queue.peek(), backoff1);
    queue.offer(backoff);
    assertEquals(queue.poll(), backoff); // Still the same one
}