### Question:
HeartbeatInfoCache implements HeartbeatContributor, Serializable { public void contributeToHttpCall(HeartbeatCall call) { for(Iterator it = infoCache.keySet().iterator(); it.hasNext();) { HeartbeatInfo info = (HeartbeatInfo)it.next(); info.contributeToHttpCall(call); } }  void update(HeartbeatInfo info); void contributeToHttpCall(HeartbeatCall call); int size();  }### Answer:
@Test void contributeToHttpCall_heartbeatInfoCacheIsEmpty_contributeToHttpCallIsNotInvoked() { infoCache.clear(); heartbeatInfoCache.contributeToHttpCall(heartbeatCall); verify(heartbeatInfo, never()).contributeToHttpCall(heartbeatCall); }
@Test void contributeToHttpCall_heartbeatInfoIsCached_contributeToHttpCallIsInvoked() { infoCache.put(heartbeatInfo, heartbeatInfo); heartbeatInfoCache.contributeToHttpCall(heartbeatCall); verify(heartbeatInfo).contributeToHttpCall(heartbeatCall); }