DiskQueue extends AbstractQueue<String> { @Override public int size() { return memoryQueue.size() + fileElementCount + (cachedElement != null ? 1 : 0); } DiskQueue(int maxInMemorySize);  DiskQueue(int maxInMemorySize, File tempDir); @Override Iterator<String> iterator(); @Override int size(); @Override boolean offer(String element); @Override String peek(); @Override String remove(); @Override String poll(); @Override void clear();  }
@Test public void testSize() { Queue<String> instance = new DiskQueue<String>(1); assertEquals(0, instance.size()); instance.add("testSize"); int result = instance.size(); assertEquals(1, result); instance.add("testSize2"); assertEquals(2, instance.size()); }