@Override
    public void updateProviders(ProviderGroup providerGroup) {
        wLock.lock();
        try {
            getProviderGroup(providerGroup.getName())
                .setProviderInfos(new ArrayList<ProviderInfo>(providerGroup.getProviderInfos()));
        } finally {
            wLock.unlock();
        }
    }
@Test
    public void updateProviders() throws Exception {
        SingleGroupAddressHolder addressHolder = new SingleGroupAddressHolder(null);

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

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

        addressHolder.updateProviders(new ProviderGroup(ADDRESS_DIRECT_GROUP, Arrays.asList(
            ProviderHelper.toProviderInfo("127.0.0.1:12200"),
            ProviderHelper.toProviderInfo("127.0.0.1:12201"),
            ProviderHelper.toProviderInfo("127.0.0.1:12202"))));
        Assert.assertTrue(addressHolder.getProviderGroup(ADDRESS_DIRECT_GROUP).size() == 3);

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