@Test
public void getNext() throws Exception {

    LoadBalancedList<String> list = LoadBalancedLists.synchronizedList(new RoundRobinLoadBalancedList<String>());
    // add just one item
    list.set("Item1", 1);
    for (int i = 0; i < 50; i++) {
        Assert.assertTrue("Failed on i=" + i, "Item1".equals(list.getNext()));
    }
    // remove it
    list.remove("Item1");
    for (int i = 0; i < 50; i++) {
        Assert.assertTrue("Failed on i=" + i, list.getNext() == null);
    }
    // add another item
    list.set("Item2", 1);
    for (int i = 0; i < 50; i++) {
        Assert.assertTrue("Failed on i=" + i, "Item2".equals(list.getNext()));
    }
    // reset weight to zero (should remove it)
    list.set("Item2", 0);
    for (int i = 0; i < 50; i++) {
        Assert.assertTrue("Failed on i=" + i, list.getNext() == null);
    }
}