@Test
public void testAddListener() throws Exception {

    CountDownLatch latch = new CountDownLatch(4);
    TestListener listener1 = new TestListener(latch);
    TestListener listener2 = new TestListener(latch);
    TestListener listener3 = new TestListener(latch);
    TestListener listener4 = new TestListener(latch);
    config.addListener("AService.configurators", listener1);
    config.addListener("AService.configurators", listener2);
    config.addListener("testapp.tag-router", listener3);
    config.addListener("testapp.tag-router", listener4);
    put("AService.configurators", "new value1");
    Thread.sleep(200);
    put("testapp.tag-router", "new value2");
    Thread.sleep(200);
    put("testapp", "new value3");
    Thread.sleep(5000);
    latch.await();
    Assertions.assertEquals(1, listener1.getCount("AService.configurators"));
    Assertions.assertEquals(1, listener2.getCount("AService.configurators"));
    Assertions.assertEquals(1, listener3.getCount("testapp.tag-router"));
    Assertions.assertEquals(1, listener4.getCount("testapp.tag-router"));
    Assertions.assertEquals("new value1", listener1.getValue());
    Assertions.assertEquals("new value1", listener2.getValue());
    Assertions.assertEquals("new value2", listener3.getValue());
    Assertions.assertEquals("new value2", listener4.getValue());
}