@Test public void testNodeIsNotRefreshed() throws UnknownHostException { final InetAddress expectedAddress = InetAddress.getLocalHost(); when(myJmxProxy.getLiveNodes()).thenAnswer(new Answer<List<String>>() { private int counter = 0; @Override public List<String> answer(InvocationOnMock invocation) { if (counter++ == 2) { return Collections.singletonList(expectedAddress.getHostAddress()); } return Collections.emptyList(); } }); when(myJmxProxy.getUnreachableNodes()).thenAnswer(new Answer<List<String>>() { private int counter = 0; @Override public List<String> answer(InvocationOnMock invocation) { if (counter++ == 2) { return Collections.emptyList(); } return Collections.singletonList(expectedAddress.getHostAddress()); } }); assertThat(myHostStates.isUp(expectedAddress)).isFalse(); assertThat(myHostStates.isUp(expectedAddress)).isFalse(); }
@Override public boolean isUp(InetAddress address) { refreshNodeStatus(); Boolean status = myHostStates.get(address); return status != null && status; }
HostStatesImpl implements HostStates, Closeable { @Override public boolean isUp(InetAddress address) { refreshNodeStatus(); Boolean status = myHostStates.get(address); return status != null && status; } }
HostStatesImpl implements HostStates, Closeable { @Override public boolean isUp(InetAddress address) { refreshNodeStatus(); Boolean status = myHostStates.get(address); return status != null && status; } private  HostStatesImpl(Builder builder); }
HostStatesImpl implements HostStates, Closeable { @Override public boolean isUp(InetAddress address) { refreshNodeStatus(); Boolean status = myHostStates.get(address); return status != null && status; } private  HostStatesImpl(Builder builder); @Override boolean isUp(InetAddress address); @Override boolean isUp(Host host); @Override void close(); static Builder builder(); }
HostStatesImpl implements HostStates, Closeable { @Override public boolean isUp(InetAddress address) { refreshNodeStatus(); Boolean status = myHostStates.get(address); return status != null && status; } private  HostStatesImpl(Builder builder); @Override boolean isUp(InetAddress address); @Override boolean isUp(Host host); @Override void close(); static Builder builder();  }