@Before
  public void setup() throws Exception {
    fmd = Mockito.mock(FailoverMetaData.class);
    metricSinkInstance = Mockito.mock(MetricSink.class);

    conf = new HiveConf();
    conf.set(Constants.SCHEDULED_QUERY_SCHEDULENAME, "repl");
    conf.set(Constants.SCHEDULED_QUERY_EXECUTIONID, "1");
    MetricCollector.getInstance().init(conf);
    Mockito.when(fmd.getFailoverEventId()).thenReturn(10L);
    Mockito.when(fmd.getFilePath()).thenReturn("dummyDir");
    disableBackgroundThreads();
  }
Unit Test class for In Memory Replication Metric Collection.
ql/src/test/org/apache/hadoop/hive/ql/parse/repl/metric/TestReplicationMetricCollector.java