RoundRobinLoadBalancedList implements LoadBalancedList<E> { @Override public void clear() { allItems.clear(); remainingItems.clear(); this.currentIndex = 0; } RoundRobinLoadBalancedList(); @Override List<Node<E>> getValues(); @Override void clear(); @Override boolean contains(E item); @Override void set(E item, int weight); @Override void remove(E item); @Override int getSize(); int getRemainingSize(); @Override E getNext(); @Override String toString();  }
@Test public void clear() throws Exception { RoundRobinLoadBalancedList<String> list = new RoundRobinLoadBalancedList<String>(); list.set("Item1", 1); list.set("Item2", 1); logger.debug("Initial list: " + list.toString()); Assert.assertEquals(2, list.getRemainingSize()); Assert.assertEquals("Item1", list.getNext()); Assert.assertEquals("Item2", list.getNext()); Assert.assertEquals(2, list.getSize()); Assert.assertEquals(2, list.getRemainingSize()); list.clear(); Assert.assertEquals(0, list.getSize()); Assert.assertEquals(0, list.getRemainingSize()); Assert.assertEquals(null, list.getNext()); }