### Question:
Heartbeat { public boolean shouldHeartbeat(long now) { return timeToNextHeartbeat(now) == 0; } Heartbeat(long sessionTimeout,
                     long heartbeatInterval,
                     long maxPollInterval,
                     long retryBackoffMs); void poll(long now); void sentHeartbeat(long now); void failHeartbeat(); void receiveHeartbeat(long now); boolean shouldHeartbeat(long now); long lastHeartbeatSend(); long timeToNextHeartbeat(long now); boolean sessionTimeoutExpired(long now); long interval(); void resetTimeouts(long now); boolean pollTimeoutExpired(long now);  }### Answer:
@Test public void testShouldHeartbeat() { heartbeat.sentHeartbeat(time.milliseconds()); time.sleep((long) ((float) interval * 1.1)); assertTrue(heartbeat.shouldHeartbeat(time.milliseconds())); }