MessageRoundtrip { public void incRetryTimes() { ++retryTimes; } MessageRoundtrip(Message msg); boolean isAnswered(); void answer(); long getRetryTimes(); void incRetryTimes(); void saveTime(); boolean hasToRetry(); Message getMsg();  }
@Test public void testMessageRetryTimes(){ P2pMessage message = mock(P2pMessage.class); MessageRoundtrip messageRoundtrip = new MessageRoundtrip(message); messageRoundtrip.incRetryTimes(); assertEquals(1L, messageRoundtrip.retryTimes); }