### Question:
MaxGauge extends Bucketed<Bucket> { public void updateInstantaneous(long value) { applyToCurrentBucket(bucket -> bucket.maxValue.accumulateAndGet(value, Long::max)); }  void update(long value); void updateInstantaneous(long value); void add(int delta); long get();  }### Answer:
@Test public void testInstantaneous() throws Exception { MaxGauge maxGauge = new MaxGauge(); maxGauge.setBucketIdProvider(bucketIdProvider); maxGauge.updateInstantaneous(1); assertPreviousMax(maxGauge, 0); ++bucketIdProvider.id; maxGauge.updateInstantaneous(3); maxGauge.updateInstantaneous(2); assertPreviousMax(maxGauge, 1); ++bucketIdProvider.id; assertPreviousMax(maxGauge, 3); ++bucketIdProvider.id; assertPreviousMax(maxGauge, 0); }