Program: 13811
Project: 13811
Buggy source:
@Test public void testReporter() throws InterruptedException {
  StoredDataPointReceiver dbank=new StoredDataPointReceiver();
  assertEquals(0,dbank.addDataPoints.size());
  MetricRegistry metricRegistery=new MetricRegistry();
  SignalFuseReporter reporter=new SignalFuseReporter.Builder(metricRegistery,new StaticAuthToken("String_Node_Str"),"String_Node_Str").setDataPointReceiverFactory(new StaticDataPointReceiverFactory(dbank)).setDetailsToAdd(ImmutableSet.of(SignalFuseReporter.MetricDetails.COUNT,SignalFuseReporter.MetricDetails.MIN,SignalFuseReporter.MetricDetails.MAX)).build();
  metricRegistery.register("String_Node_Str",new Gauge<Integer>(){
    public Integer getValue(){
      return 1;
    }
  }
);
  reporter.getMetricMetadata().tagMetric(metricRegistery.counter("String_Node_Str")).withMetricName("String_Node_Str").withSourceName("String_Node_Str").withMetricType(SignalFuseProtocolBuffers.MetricType.GAUGE);
  metricRegistery.counter("String_Node_Str").inc();
  metricRegistery.counter("String_Node_Str").inc();
  metricRegistery.timer("String_Node_Str").time().close();
  reporter.report();
  assertEquals(5,dbank.addDataPoints.size());
  assertEquals("String_Node_Str",dbank.addDataPoints.get(1).getMetric());
  assertEquals("String_Node_Str",dbank.addDataPoints.get(1).getSource());
  assertEquals(SignalFuseProtocolBuffers.MetricType.GAUGE,dbank.registeredMetrics.get("String_Node_Str"));
  assertEquals(SignalFuseProtocolBuffers.MetricType.CUMULATIVE_COUNTER,dbank.registeredMetrics.get("String_Node_Str"));
  assertEquals(SignalFuseProtocolBuffers.MetricType.GAUGE,dbank.registeredMetrics.get("String_Node_Str"));
  assertEquals(2,dbank.lastValueFor("String_Node_Str","String_Node_Str").getIntValue());
  assertEquals("String_Node_Str",dbank.addDataPoints.get(2).getMetric());
  dbank.addDataPoints.clear();
  reporter.getMetricMetadata().tagMetric(metricRegistery.counter("String_Node_Str")).withMetricType(SignalFuseProtocolBuffers.MetricType.COUNTER);
  SfUtil.cumulativeCounter(metricRegistery,"String_Node_Str",reporter.getMetricMetadata(),new Gauge<Long>(){
    private long i=0;
    @Override public Long getValue(){
      return i++;
    }
  }
);
  metricRegistery.counter("String_Node_Str").inc(10);
  reporter.report();
  assertEquals(7,dbank.addDataPoints.size());
  assertEquals(10,dbank.lastValueFor("String_Node_Str","String_Node_Str").getIntValue());
  assertEquals(0,dbank.lastValueFor("String_Node_Str","String_Node_Str").getIntValue());
  assertEquals(SignalFuseProtocolBuffers.MetricType.COUNTER,dbank.registeredMetrics.get("String_Node_Str"));
  assertEquals(SignalFuseProtocolBuffers.MetricType.CUMULATIVE_COUNTER,dbank.registeredMetrics.get("String_Node_Str"));
  metricRegistery.counter("String_Node_Str").inc(14);
  dbank.addDataPoints.clear();
  reporter.report();
  assertEquals(7,dbank.addDataPoints.size());
  assertEquals(14,dbank.lastValueFor("String_Node_Str","String_Node_Str").getIntValue());
  assertEquals(1,dbank.lastValueFor("String_Node_Str","String_Node_Str").getIntValue());
}

Fixed version (ground truth):
@Test public void testReporter() throws InterruptedException {
  StoredDataPointReceiver dbank=new StoredDataPointReceiver();
  assertEquals(0,dbank.addDataPoints.size());
  MetricRegistry metricRegistery=new MetricRegistry();
  SignalFuseReporter reporter=new SignalFuseReporter.Builder(metricRegistery,new StaticAuthToken("String_Node_Str"),"String_Node_Str").setDataPointReceiverFactory(new StaticDataPointReceiverFactory(dbank)).setDetailsToAdd(ImmutableSet.of(SignalFuseReporter.MetricDetails.COUNT,SignalFuseReporter.MetricDetails.MIN,SignalFuseReporter.MetricDetails.MAX)).build();
  metricRegistery.register("String_Node_Str",new Gauge<Integer>(){
    public Integer getValue(){
      return 1;
    }
  }
);
  reporter.getMetricMetadata().tagMetric(metricRegistery.counter("String_Node_Str")).withMetricName("String_Node_Str").withSourceName("String_Node_Str").withMetricType(SignalFuseProtocolBuffers.MetricType.GAUGE);
  reporter.getMetricMetadata().tagMetric(metricRegistery.counter("String_Node_Str")).withMetricName("String_Node_Str");
  metricRegistery.counter("String_Node_Str").inc();
  metricRegistery.counter("String_Node_Str").inc();
  metricRegistery.timer("String_Node_Str").time().close();
  reporter.report();
  assertEquals(6,dbank.addDataPoints.size());
  assertEquals("String_Node_Str",dbank.addDataPoints.get(1).getMetric());
  assertEquals("String_Node_Str",dbank.addDataPoints.get(1).getSource());
  assertEquals(SignalFuseProtocolBuffers.MetricType.GAUGE,dbank.registeredMetrics.get("String_Node_Str"));
  assertEquals(SignalFuseProtocolBuffers.MetricType.CUMULATIVE_COUNTER,dbank.registeredMetrics.get("String_Node_Str"));
  assertEquals(SignalFuseProtocolBuffers.MetricType.GAUGE,dbank.registeredMetrics.get("String_Node_Str"));
  assertEquals(2,dbank.lastValueFor("String_Node_Str","String_Node_Str").getIntValue());
  assertNotNull(dbank.lastValueFor("String_Node_Str","String_Node_Str"));
  dbank.addDataPoints.clear();
  reporter.getMetricMetadata().tagMetric(metricRegistery.counter("String_Node_Str")).withMetricType(SignalFuseProtocolBuffers.MetricType.COUNTER);
  SfUtil.cumulativeCounter(metricRegistery,"String_Node_Str",reporter.getMetricMetadata(),new Gauge<Long>(){
    private long i=0;
    @Override public Long getValue(){
      return i++;
    }
  }
);
  metricRegistery.counter("String_Node_Str").inc(10);
  reporter.report();
  assertEquals(8,dbank.addDataPoints.size());
  assertEquals(10,dbank.lastValueFor("String_Node_Str","String_Node_Str").getIntValue());
  assertEquals(0,dbank.lastValueFor("String_Node_Str","String_Node_Str").getIntValue());
  assertEquals(SignalFuseProtocolBuffers.MetricType.COUNTER,dbank.registeredMetrics.get("String_Node_Str"));
  assertEquals(SignalFuseProtocolBuffers.MetricType.CUMULATIVE_COUNTER,dbank.registeredMetrics.get("String_Node_Str"));
  metricRegistery.counter("String_Node_Str").inc(14);
  dbank.addDataPoints.clear();
  reporter.report();
  assertEquals(8,dbank.addDataPoints.size());
  assertEquals(14,dbank.lastValueFor("String_Node_Str","String_Node_Str").getIntValue());
  assertEquals(1,dbank.lastValueFor("String_Node_Str","String_Node_Str").getIntValue());
}