@Test
public void check() {

    @SuppressWarnings("unchecked")
    List<InetSocketAddress> list = Mockito.mock(List.class);
    JndiChangeNotifier spy = Mockito.spy(jndiChangeNotifier);
    Mockito.when(spy.getAddresses()).thenReturn(list);
    spy.check();
    spy.check();
    Mockito.verify(addressChangeListener, Mockito.only()).changeAddresses(list);
}