@Override
    public void addProvider(ProviderGroup providerGroup) {
        if (ProviderHelper.isEmpty(providerGroup)) {
            return;
        }
        wLock.lock();
        try {
            getProviderGroup(providerGroup.getName()).addAll(providerGroup.getProviderInfos());
        } finally {
            wLock.unlock();
        }
    }
@Test
    public void addProvider() throws Exception {
        SingleGroupAddressHolder addressHolder = new SingleGroupAddressHolder(null);

        addressHolder.addProvider(new ProviderGroup("xxx", new ArrayList<ProviderInfo>()));
        Assert.assertTrue(addressHolder.getProviderGroup(ADDRESS_DEFAULT_GROUP).size() == 0);

        addressHolder.addProvider(new ProviderGroup("xxx", Arrays.asList(
            ProviderHelper.toProviderInfo("127.0.0.1:12200"),
            ProviderHelper.toProviderInfo("127.0.0.1:12201"))));
        Assert.assertTrue(addressHolder.getProviderGroup(ADDRESS_DEFAULT_GROUP).size() == 2);

        addressHolder.addProvider(new ProviderGroup(ADDRESS_DIRECT_GROUP, new ArrayList<ProviderInfo>()));
        Assert.assertTrue(addressHolder.getProviderGroup(ADDRESS_DIRECT_GROUP).size() == 0);

        addressHolder.addProvider(new ProviderGroup(ADDRESS_DIRECT_GROUP,
            Arrays.asList(ProviderHelper.toProviderInfo("127.0.0.1:12200"),
                ProviderHelper.toProviderInfo("127.0.0.1:12201"))));
        Assert.assertTrue(addressHolder.getProviderGroup(ADDRESS_DIRECT_GROUP).size() == 2);
    }