@Test
public void testRunNegative() throws Exception {

  TimelineMetricStore metricStore = createNiceMock(TimelineMetricStore.class);
  expect(metricStore.putMetrics(anyObject(TimelineMetrics.class)))
    .andReturn(new TimelinePutResponse());
  // no metrics found
  expect(metricStore.getTimelineMetrics(EasyMock.<List<String>>anyObject(),
    EasyMock.<List<String>>anyObject(), anyObject(String.class),
    anyObject(String.class), anyObject(Long.class), anyObject(Long.class),
    eq(Precision.SECONDS), eq(1), eq(true), anyObject(TopNConfig.class), anyString()))
    .andReturn(null).anyTimes();
  String msg = "Error getting metrics from TimelineMetricStore. " +
    "Shutting down by TimelineMetricStoreWatcher.";
  mockStatic(ExitUtil.class);
  ExitUtil.terminate(-1, msg);
  expectLastCall().anyTimes();
  replayAll();
  TimelineMetricStoreWatcher timelineMetricStoreWatcher =
    new TimelineMetricStoreWatcher(metricStore, new TimelineMetricConfiguration());
  timelineMetricStoreWatcher.run();
  timelineMetricStoreWatcher.run();
  timelineMetricStoreWatcher.run();
  verifyAll();
}