@Test
public void testSubscribe() {

    ProviderConfig<?> providerConfig = providerConfig("consul-test-1", 12200, 12201, 12202);
    registry.register(providerConfig);
    ConsumerConfig<?> consumerConfig = consumerConfig("consul-test-1");
    assertUntil(() -> {
        List<ProviderGroup> providerGroups = registry.subscribe(consumerConfig);
        Assert.assertEquals(1, providerGroups.size());
        Assert.assertEquals(3, providerGroups.get(0).size());
    }, 10, TimeUnit.SECONDS);
    ConsumerConfig<?> consumerConfigWithAnotherUniqueId = consumerConfig("consul-test-2");
    assertUntil(() -> {
        List<ProviderGroup> providerGroups = registry.subscribe(consumerConfigWithAnotherUniqueId);
        Assert.assertEquals(1, providerGroups.size());
        Assert.assertEquals(0, providerGroups.get(0).size());
    }, 10, TimeUnit.SECONDS);
    registry.unSubscribe(consumerConfig);
    registry.unSubscribe(consumerConfigWithAnotherUniqueId);
}