### Question:
Dependency { public void addListenerToDependentProperties(PropertyChangeListener listener) { for (String dependentProperty : dependentProperties) { observableBean.addPropertyChangeListener(dependentProperty, listener); } } Dependency(ObservableBean observableBean, Set<String> dependentProperties); void addListenerToDependentProperties(PropertyChangeListener listener); void removeListenerOffDependentProperties(PropertyChangeListener listener); Set<String> getDependentProperties();  }### Answer:
@Test public void whenAddListener_thenListenersAddedToAllDependentProperties() { Set<String> dependentProperties = Sets.newHashSet("prop1", "prop2"); Dependency dependency = new Dependency(bean, dependentProperties); dependency.addListenerToDependentProperties(listener); assertListenerOnProperties(dependentProperties); }