TrackedPriorityBlockingQueue extends PriorityBlockingQueue<E> implements ITrackedQueue<E> { public Long getLastAddedTime() { return lastAddedTime; } TrackedPriorityBlockingQueue(); Long getOldestItemTime(); @Override boolean offer(E e); @Override E poll(); @Override boolean remove(Object o); Long getLastAddedTime(); Long getLastRemovedTime();  }
@Test public void getLastAddedTime() throws InterruptedException { Thread.sleep(10); long now = System.currentTimeMillis(); queue.offer(item101); assertTrue(timeBuffer(now, (long)queue.getLastAddedTime())); }
@Test public void getLastAddedTimeNull() { TrackedPriorityBlockingQueue<SimpleItem> queue = new TrackedPriorityBlockingQueue<SimpleItem>(); queue.clear(); Assert.assertNull("oldest time should be null", queue.getLastAddedTime()); }