### Question:
StatusManager implements Reportable { public void checkup() { long now = Clock.unixTime(); HashMap<String, NodeStatus> ss = null; synchronized (statuses) { ss = new HashMap<String, NodeStatus>(statuses); } int maxMissed = FlumeConfiguration.get().getMasterMaxMissedheartbeats(); long timeout = FlumeConfiguration.get().getConfigHeartbeatPeriod() * maxMissed; for (Entry<String, NodeStatus> e : ss.entrySet()) { NodeStatus ns = e.getValue(); long delta = now - ns.lastseen; if (delta > timeout) { ns.state = NodeState.LOST; } String expectedPhys = FlumeMaster.getInstance().getSpecMan() .getPhysicalNode(e.getKey()); if (expectedPhys == null || !expectedPhys.equals(ns.physicalNode)) { ns.state = NodeState.DECOMMISSIONED; } } }  boolean updateHeartbeatStatus(String host, String physicalNode,
      String logicalNode, NodeState stat, long version); void checkup(); @Override String getName(); @Override ReportEvent getReport(); Map<String, NodeStatus> getNodeStatuses(); NodeStatus getStatus(String node);  }### Answer:
@Test public void testCheckup() throws IOException { MockClock clk = new MockClock(0); Clock.setClock(clk); StatusManager stats = new StatusManager(); long prev = Clock.unixTime(); boolean needsRefresh = stats.updateHeartbeatStatus(NetUtils.localhost(), "physnode", "foo", NodeState.HELLO, 0); LOG.info(stats.getNodeStatuses()); assertTrue(needsRefresh); clk.forward(FlumeConfiguration.get().getConfigHeartbeatPeriod() * 5); stats.checkup(); StatusManager.NodeStatus ns = stats.getNodeStatuses().get("foo"); assertEquals(0, ns.version); assertTrue(prev <= ns.lastseen); assertEquals(NodeState.HELLO, ns.state); prev = ns.lastseen; clk.forward(FlumeConfiguration.get().getConfigHeartbeatPeriod() * 20); stats.checkup(); ns = stats.getNodeStatuses().get("foo"); assertEquals(0, ns.version); assertTrue(prev <= ns.lastseen); assertEquals(NodeState.LOST, ns.state); prev = ns.lastseen; LOG.info(ns.toString()); LOG.info(stats.getStatus("foo").toString()); }