use of io.dropwizard.metrics.WeightedSnapshot in project light-4j by networknt.
the class WeightedSnapshotTest method calculatesAMeanOfZeroForAnEmptySnapshot.
@Test
public void calculatesAMeanOfZeroForAnEmptySnapshot() throws Exception {
final Snapshot emptySnapshot = new WeightedSnapshot(WeightedArray(new long[] {}, new double[] {}));
assertThat(emptySnapshot.getMean()).isZero();
}
use of io.dropwizard.metrics.WeightedSnapshot in project light-4j by networknt.
the class WeightedSnapshotTest method worksWithUnderestimatedCollections.
@Test
public void worksWithUnderestimatedCollections() throws Exception {
final List<WeightedSample> items = spy(WeightedArray(new long[] { 5, 1, 2, 3, 4 }, new double[] { 1, 2, 3, 2, 2 }));
when(items.size()).thenReturn(4, 5);
final Snapshot other = new WeightedSnapshot(items);
assertThat(other.getValues()).containsOnly(1, 2, 3, 4, 5);
}
use of io.dropwizard.metrics.WeightedSnapshot in project light-4j by networknt.
the class WeightedSnapshotTest method calculatesAMaxOfZeroForAnEmptySnapshot.
@Test
public void calculatesAMaxOfZeroForAnEmptySnapshot() throws Exception {
final Snapshot emptySnapshot = new WeightedSnapshot(WeightedArray(new long[] {}, new double[] {}));
assertThat(emptySnapshot.getMax()).isZero();
}
Aggregations