Beispiel #1
0
  @Test
  public void testFifoPeek() throws Exception {

    BoundMetricFifo fifo = new BoundMetricFifo(10, 15);

    SingleMetric metric = new SingleMetric("foo", 12345L, 42.0d);
    fifo.offer(metric);

    assert fifo.size() == 1 : "Size should be 1 but was " + fifo.size();
    assert !fifo.isEmpty() : "Fifo should not be empty but it was";

    SingleMetric peekResult = fifo.peek();
    assert peekResult != null : "Got nothing back from the fifo";
    assert peekResult.equals(metric);

    assert fifo.size() == 1 : "Size should be 1 but was " + fifo.size();

    fifo = new BoundMetricFifo(10, 3);
    peekResult = fifo.peek();
    assert peekResult == null;
  }