MessageRoundtrip { public boolean hasToRetry() { return 20000 < System.currentTimeMillis() - lastTimestamp; } MessageRoundtrip(Message msg); boolean isAnswered(); void answer(); long getRetryTimes(); void incRetryTimes(); void saveTime(); boolean hasToRetry(); Message getMsg();  }
@Test public void testHasToRetry(){ P2pMessage message = mock(P2pMessage.class); MessageRoundtrip messageRoundtrip = new MessageRoundtrip(message); messageRoundtrip.saveTime(); assertFalse(messageRoundtrip.hasToRetry()); }