### Question:
BucketFunctions { public static BucketFunction latency(long max, TimeUnit unit) { return wrap(com.netflix.spectator.api.histogram.BucketFunctions.latency(max, unit)); } private  BucketFunctions(); static BucketFunction age(long max, TimeUnit unit); static BucketFunction latency(long max, TimeUnit unit); static BucketFunction ageBiasOld(long max, TimeUnit unit); static BucketFunction latencyBiasSlow(long max, TimeUnit unit);  }### Answer:
@Test public void latency100ms() { BucketFunction f = BucketFunctions.latency(100, TimeUnit.MILLISECONDS); Assertions.assertEquals("negative_latency", f.apply(TimeUnit.MILLISECONDS.toNanos(-1))); Assertions.assertEquals("012ms", f.apply(TimeUnit.MILLISECONDS.toNanos(1))); Assertions.assertEquals("025ms", f.apply(TimeUnit.MILLISECONDS.toNanos(13))); Assertions.assertEquals("025ms", f.apply(TimeUnit.MILLISECONDS.toNanos(25))); Assertions.assertEquals("100ms", f.apply(TimeUnit.MILLISECONDS.toNanos(99))); Assertions.assertEquals("slow", f.apply(TimeUnit.MILLISECONDS.toNanos(101))); }
@Test public void latency3s() { BucketFunction f = BucketFunctions.latency(3, TimeUnit.SECONDS); Assertions.assertEquals("negative_latency", f.apply(TimeUnit.MILLISECONDS.toNanos(-1))); Assertions.assertEquals("0375ms", f.apply(TimeUnit.MILLISECONDS.toNanos(25))); Assertions.assertEquals("0750ms", f.apply(TimeUnit.MILLISECONDS.toNanos(740))); Assertions.assertEquals("1500ms", f.apply(TimeUnit.MILLISECONDS.toNanos(1000))); Assertions.assertEquals("3000ms", f.apply(TimeUnit.MILLISECONDS.toNanos(1567))); Assertions.assertEquals("slow", f.apply(TimeUnit.MILLISECONDS.toNanos(3001))); }