@Test public void checkNullAdress() { JndiChangeNotifier spy = Mockito.spy(jndiChangeNotifier); Mockito.when(spy.getAddresses()).thenReturn(null); spy.check(); Mockito.verifyZeroInteractions(addressChangeListener); }
public void check() { List<InetSocketAddress> newAddrs = getAddresses(); if (newAddrs != null && !newAddrs.equals(currentAddrs)) { if (addressChangeListener != null) { currentAddrs = newAddrs; addressChangeListener.changeAddresses(newAddrs); } else { LOGGER.error("Address change listener is null for JNDI key {}, cannot notify about new value {}", getJndiKey(), newAddrs); } } }
JndiChangeNotifier extends JndiAddressProvider implements AddressChangeNotifier, InitializingBean { public void check() { List<InetSocketAddress> newAddrs = getAddresses(); if (newAddrs != null && !newAddrs.equals(currentAddrs)) { if (addressChangeListener != null) { currentAddrs = newAddrs; addressChangeListener.changeAddresses(newAddrs); } else { LOGGER.error("Address change listener is null for JNDI key {}, cannot notify about new value {}", getJndiKey(), newAddrs); } } } }
JndiChangeNotifier extends JndiAddressProvider implements AddressChangeNotifier, InitializingBean { public void check() { List<InetSocketAddress> newAddrs = getAddresses(); if (newAddrs != null && !newAddrs.equals(currentAddrs)) { if (addressChangeListener != null) { currentAddrs = newAddrs; addressChangeListener.changeAddresses(newAddrs); } else { LOGGER.error("Address change listener is null for JNDI key {}, cannot notify about new value {}", getJndiKey(), newAddrs); } } }  }
JndiChangeNotifier extends JndiAddressProvider implements AddressChangeNotifier, InitializingBean { public void check() { List<InetSocketAddress> newAddrs = getAddresses(); if (newAddrs != null && !newAddrs.equals(currentAddrs)) { if (addressChangeListener != null) { currentAddrs = newAddrs; addressChangeListener.changeAddresses(newAddrs); } else { LOGGER.error("Address change listener is null for JNDI key {}, cannot notify about new value {}", getJndiKey(), newAddrs); } } }  @Override void afterPropertiesSet(); void check(); }
JndiChangeNotifier extends JndiAddressProvider implements AddressChangeNotifier, InitializingBean { public void check() { List<InetSocketAddress> newAddrs = getAddresses(); if (newAddrs != null && !newAddrs.equals(currentAddrs)) { if (addressChangeListener != null) { currentAddrs = newAddrs; addressChangeListener.changeAddresses(newAddrs); } else { LOGGER.error("Address change listener is null for JNDI key {}, cannot notify about new value {}", getJndiKey(), newAddrs); } } }  @Override void afterPropertiesSet(); void check();  }