@Test
public void testAddListener() throws Exception {

    String mockKey = "mockKey3";
    String mockValue = String.valueOf(new Random().nextInt());
    final SettableFuture<org.apache.dubbo.common.config.configcenter.ConfigChangedEvent> future = SettableFuture.create();
    apolloDynamicConfiguration = new ApolloDynamicConfiguration(url);
    apolloDynamicConfiguration.addListener(mockKey, DEFAULT_NAMESPACE, new ConfigurationListener() {
        @Override
        public void process(org.apache.dubbo.common.config.configcenter.ConfigChangedEvent event) {
            future.set(event);
        }
    });
    putData(mockKey, mockValue);
    org.apache.dubbo.common.config.configcenter.ConfigChangedEvent result = future.get(3000, TimeUnit.MILLISECONDS);
    assertEquals(mockValue, result.getContent());
    assertEquals(mockKey, result.getKey());
    assertEquals(ConfigChangeType.MODIFIED, result.getChangeType());
}