ConfigPropertySource extends EnumerablePropertySource<Config> { public void addChangeListener(ConfigChangeListener listener) { this.source.addChangeListener(listener); } ConfigPropertySource(String name, Config source); @Override String[] getPropertyNames(); @Override Object getProperty(String name); void addChangeListener(ConfigChangeListener listener);  }
@Test public void testAddChangeListener() throws Exception { ConfigChangeListener someListener = mock(ConfigChangeListener.class); ConfigChangeListener anotherListener = mock(ConfigChangeListener.class); final List<ConfigChangeListener> listeners = Lists.newArrayList(); doAnswer(new Answer() { @Override public Object answer(InvocationOnMock invocation) throws Throwable { listeners.add(invocation.getArgumentAt(0, ConfigChangeListener.class)); return Void.class; } }).when(someConfig).addChangeListener(any(ConfigChangeListener.class)); configPropertySource.addChangeListener(someListener); configPropertySource.addChangeListener(anotherListener); assertEquals(2, listeners.size()); assertTrue(listeners.containsAll(Lists.newArrayList(someListener, anotherListener))); }