@Before
  public void setup() throws Exception {
    conf = new HiveConf();
    conf.set(Constants.SCHEDULED_QUERY_SCHEDULENAME, "repl");
    conf.set(Constants.SCHEDULED_QUERY_EXECUTIONID, "1");
    MetricSink metricSinkSpy = Mockito.spy(MetricSink.getInstance());
    Mockito.doReturn(1L).when(metricSinkSpy).getFrequencyInSecs();
    metricSinkSpy.init(conf);
    deserializer = MessageFactory.getDefaultInstanceForReplMetrics(conf).getDeserializer();
  }
Unit Test class for In Memory Replication Metric Collection.
ql/src/test/org/apache/hadoop/hive/ql/parse/repl/metric/TestReplicationMetricSink.java