@Test
public void compareProviders() throws Exception {

    ProviderGroup group1 = new ProviderGroup("a");
    ProviderGroup group2 = new ProviderGroup("a");
    List<ProviderInfo> oldList = new ArrayList<ProviderInfo>();
    List<ProviderInfo> newList = new ArrayList<ProviderInfo>();
    List<ProviderInfo> add = new ArrayList<ProviderInfo>();
    List<ProviderInfo> remove = new ArrayList<ProviderInfo>();
    group1.setProviderInfos(oldList);
    group2.setProviderInfos(newList);
    {
        ProviderHelper.compareGroup(group1, group2, add, remove);
        Assert.assertEquals(add.size(), 0);
        Assert.assertEquals(remove.size(), 0);
    }
    {
        oldList.clear();
        newList.clear();
        add.clear();
        remove.clear();
        oldList.add(ProviderHelper.toProviderInfo("127.0.0.1:12200?p=11&v=4.0"));
        oldList.add(ProviderHelper.toProviderInfo("127.0.0.2:12200?p=11&v=4.0"));
        oldList.add(ProviderHelper.toProviderInfo("127.0.0.3:12200?p=11&v=4.0"));
        ProviderHelper.compareGroup(group1, group2, add, remove);
        Assert.assertEquals(add.size(), 0);
        Assert.assertEquals(remove.size(), 3);
    }
    {
        oldList.clear();
        newList.clear();
        add.clear();
        remove.clear();
        newList.add(ProviderHelper.toProviderInfo("127.0.0.1:12200?p=11&v=4.0"));
        newList.add(ProviderHelper.toProviderInfo("127.0.0.2:12200?p=11&v=4.0"));
        newList.add(ProviderHelper.toProviderInfo("127.0.0.3:12200?p=11&v=4.0"));
        ProviderHelper.compareGroup(group1, group2, add, remove);
        Assert.assertEquals(add.size(), 3);
        Assert.assertEquals(remove.size(), 0);
    }
    {
        oldList.clear();
        newList.clear();
        add.clear();
        remove.clear();
        oldList.add(ProviderHelper.toProviderInfo("127.0.0.1:12200?p=11&v=4.0"));
        oldList.add(ProviderHelper.toProviderInfo("127.0.0.2:12200?p=11&v=4.0"));
        oldList.add(ProviderHelper.toProviderInfo("127.0.0.3:12200?p=11&v=4.0"));
        newList.add(ProviderHelper.toProviderInfo("127.0.0.1:12200?p=11&v=4.0"));
        newList.add(ProviderHelper.toProviderInfo("127.0.0.4:12200?p=11&v=4.0"));
        newList.add(ProviderHelper.toProviderInfo("127.0.0.5:12200?p=11&v=4.0"));
        ProviderHelper.compareGroup(group1, group2, add, remove);
        Assert.assertEquals(add.size(), 2);
        Assert.assertEquals(remove.size(), 2);
    }
}