@Test
public void testAddorChangeProperty(){
AbstractConfiguration.setDefaultListDelimiter(',');
AbstractConfiguration config = new ConcurrentCompositeConfiguration();
config.addConfigurationListener(new ExpandedConfigurationListenerAdapter(new MyListener()));
MyListener.resetCount();
config.setProperty("test.host", "test,test1,test2");
assertEquals(1, MyListener.count);
dynamicPropertyUpdater.addOrChangeProperty("test.host", "test,test1,test2", config);
assertEquals(3,((CopyOnWriteArrayList)(config.getProperty("test.host"))).size());
assertTrue(((CopyOnWriteArrayList)(config.getProperty("test.host"))).contains("test"));
assertTrue(((CopyOnWriteArrayList)(config.getProperty("test.host"))).contains("test1"));
assertTrue(((CopyOnWriteArrayList)(config.getProperty("test.host"))).contains("test2"));
assertEquals(1, MyListener.count);
dynamicPropertyUpdater.addOrChangeProperty("test.host", "test,test1,test2", config);
assertEquals(3,((CopyOnWriteArrayList)(config.getProperty("test.host"))).size());
assertTrue(((CopyOnWriteArrayList)(config.getProperty("test.host"))).contains("test"));
assertTrue(((CopyOnWriteArrayList)(config.getProperty("test.host"))).contains("test1"));
assertTrue(((CopyOnWriteArrayList)(config.getProperty("test.host"))).contains("test2"));
assertEquals(1, MyListener.count);
dynamicPropertyUpdater.addOrChangeProperty("test.host", "test,test1", config);
assertEquals(2,((CopyOnWriteArrayList)(config.getProperty("test.host"))).size());
assertTrue(((CopyOnWriteArrayList)(config.getProperty("test.host"))).contains("test"));
assertTrue(((CopyOnWriteArrayList)(config.getProperty("test.host"))).contains("test1"));
assertEquals(2, MyListener.count);
dynamicPropertyUpdater.addOrChangeProperty("test.host1", "test1,test12", config);
assertEquals(2,((CopyOnWriteArrayList)(config.getProperty("test.host1"))).size());
assertTrue(((CopyOnWriteArrayList)(config.getProperty("test.host1"))).contains("test1"));
assertTrue(((CopyOnWriteArrayList)(config.getProperty("test.host1"))).contains("test12"));
assertEquals(3, MyListener.count);
config.setProperty("test.host1", "test1.test12");
dynamicPropertyUpdater.addOrChangeProperty("test.host1", "test1.test12", config);
assertEquals("test1.test12",config.getProperty("test.host1"));
assertEquals(4, MyListener.count);
}