@Test
public void testReboot() throws Exception {

  Configuration conf = new Configuration();
  rm = new MockRM(conf);
  rm.start();
  MockNM nm1 = rm.registerNode("host1:1234", 5120);
  MockNM nm2 = rm.registerNode("host2:1234", 2048);
  int initialMetricCount = ClusterMetrics.getMetrics().getNumRebootedNMs();
  NodeHeartbeatResponse nodeHeartbeat = nm1.nodeHeartbeat(true);
  Assert.assertTrue(NodeAction.NORMAL.equals(nodeHeartbeat.getNodeAction()));
  nodeHeartbeat = nm2.nodeHeartbeat(
    new HashMap<ApplicationId, List<ContainerStatus>>(), true, -100);
  Assert.assertTrue(NodeAction.RESYNC.equals(nodeHeartbeat.getNodeAction()));
  Assert.assertEquals("Too far behind rm response id:0 nm response id:-100",
    nodeHeartbeat.getDiagnosticsMessage());
  checkRebootedNMCount(rm, ++initialMetricCount);
}