@Test
public void testBasicLogger() throws IOException {

      File tempFile = new File("/tmp/testhistointlog.hdr");
    File tempFile = File.createTempFile("testhistointlog", "hdr", new File("/tmp"));
    tempFile.deleteOnExit();
    HistoIntervalLogger hil = new HistoIntervalLogger("loggertest", tempFile, Pattern.compile(".*"), 1000);
    final int significantDigits = 4;
    NicerHistogram nicerHistogram = new NicerHistogram(
            "histo1", new DeltaHdrHistogramReservoir("histo1", significantDigits));
    hil.onHistogramAdded("histo1",nicerHistogram);
    List<Long> moments = new ArrayList<>(100);
    moments.add(System.currentTimeMillis()); // 0
    nicerHistogram.update(1L);
    moments.add(System.currentTimeMillis()); // 1
    delay(1001);
    moments.add(System.currentTimeMillis()); // 2
    nicerHistogram.update(1000000L);
    moments.add(System.currentTimeMillis()); // 3
    delay(1001);
    moments.add(System.currentTimeMillis()); // 4
    nicerHistogram.update(1000L);
    moments.add(System.currentTimeMillis()); // 5
    hil.onHistogramRemoved("histo1");
    moments.add(System.currentTimeMillis()); // 6
    hil.closeMetrics();
    HistogramLogReader hlr = new HistogramLogReader(tempFile.getAbsolutePath());
    List<EncodableHistogram> histos = new ArrayList<>();
    EncodableHistogram histogram;
    while (true) {
        histogram = hlr.nextIntervalHistogram();
        if (histogram==null) {
            break;
        }
        histos.add(histogram);
    };
    assertThat(histos.size()).isEqualTo(2);
    assertThat(histos.get(0)).isInstanceOf(Histogram.class);
    assertThat(((Histogram)histos.get(0)).getNumberOfSignificantValueDigits()).isEqualTo(significantDigits);
}