UniformSnapshot extends AbstractSnapshot { @Override public long getMax() { if (values.length == 0) { return 0; } return values[values.length - 1]; } UniformSnapshot(Collection<Long> values);  UniformSnapshot(long[] values); @Override double getValue(double quantile); @Override int size(); @Override long[] getValues(); @Override long getMax(); @Override long getMin(); @Override double getMean(); @Override double getStdDev(); @Override void dump(OutputStream output);  }
@Test public void calculatesTheMaximumValue() throws Exception { assertThat(snapshot.getMax()) .isEqualTo(5); }
@Test public void calculatesAMaxOfZeroForAnEmptySnapshot() throws Exception { final Snapshot emptySnapshot = new UniformSnapshot(new long[]{ }); assertThat(emptySnapshot.getMax()) .isZero(); }