@Override
    public ProviderGroup getProviderGroup(String groupName) {
        rLock.lock();
        try {
            return RpcConstants.ADDRESS_DIRECT_GROUP.equals(groupName) ? directUrlGroup
                : registryGroup;
        } finally {
            rLock.unlock();
        }
    }
@Test
    public void getProviders() throws Exception {
        SingleGroupAddressHolder addressHolder = new SingleGroupAddressHolder(null);
        Assert.assertTrue(ProviderHelper.isEmpty(addressHolder.getProviderGroup(null)));
        Assert.assertTrue(ProviderHelper.isEmpty(addressHolder.getProviderGroup(StringUtils.EMPTY)));
        Assert.assertTrue(ProviderHelper.isEmpty(addressHolder.getProviderGroup(ADDRESS_DEFAULT_GROUP)));

        addressHolder.registryGroup.add(ProviderHelper.toProviderInfo("127.0.0.1:12200"));
        addressHolder.registryGroup.add(ProviderHelper.toProviderInfo("127.0.0.1:12201"));

        Assert.assertTrue(addressHolder.getProviderGroup(null).size() == 2);
        Assert.assertTrue(addressHolder.getProviderGroup(StringUtils.EMPTY).size() == 2);
        Assert.assertTrue(addressHolder.getProviderGroup(ADDRESS_DEFAULT_GROUP).size() == 2);

        addressHolder.directUrlGroup.add(ProviderHelper.toProviderInfo("127.0.0.1:12200"));

        Assert.assertTrue(addressHolder.getProviderGroup(ADDRESS_DIRECT_GROUP).size() == 1);
        Assert.assertTrue(addressHolder.getProviderGroup(null).size() == 2);
        Assert.assertTrue(addressHolder.getProviderGroup(StringUtils.EMPTY).size() == 2);
        Assert.assertTrue(addressHolder.getProviderGroup(ADDRESS_DEFAULT_GROUP).size() == 2);
    }