### Question:
BucketFunctions { public static LongFunction<String> latencyBiasSlow(long max, TimeUnit unit) { return timeBiasMax("negative_latency", "slow", max, unit); } private  BucketFunctions(); static LongFunction<String> age(long max, TimeUnit unit); static LongFunction<String> latency(long max, TimeUnit unit); static LongFunction<String> ageBiasOld(long max, TimeUnit unit); static LongFunction<String> latencyBiasSlow(long max, TimeUnit unit); static LongFunction<String> bytes(long max); static LongFunction<String> decimal(long max);  }### Answer:
@Test public void latency100msBiasSlow() { LongFunction<String> f = BucketFunctions.latencyBiasSlow(100, TimeUnit.MILLISECONDS); Assertions.assertEquals("negative_latency", f.apply(TimeUnit.MILLISECONDS.toNanos(-1))); Assertions.assertEquals("050ms", f.apply(TimeUnit.MILLISECONDS.toNanos(0))); Assertions.assertEquals("050ms", f.apply(TimeUnit.MILLISECONDS.toNanos(1))); Assertions.assertEquals("050ms", f.apply(TimeUnit.MILLISECONDS.toNanos(13))); Assertions.assertEquals("050ms", f.apply(TimeUnit.MILLISECONDS.toNanos(25))); Assertions.assertEquals("075ms", f.apply(TimeUnit.MILLISECONDS.toNanos(74))); Assertions.assertEquals("075ms", f.apply(TimeUnit.MILLISECONDS.toNanos(75))); Assertions.assertEquals("087ms", f.apply(TimeUnit.MILLISECONDS.toNanos(76))); Assertions.assertEquals("100ms", f.apply(TimeUnit.MILLISECONDS.toNanos(99))); Assertions.assertEquals("slow", f.apply(TimeUnit.MILLISECONDS.toNanos(101))); }
@Test public void latencyBiasSlowRange() { for (BucketFunctions.ValueFormatter fmt : BucketFunctions.TIME_FORMATTERS) { final long max = fmt.max(); LongFunction<String> f = BucketFunctions.latencyBiasSlow(max, TimeUnit.NANOSECONDS); Set<String> keys = new HashSet<>(); final long step = (max > 37) ? max / 37 : 1; for (long j = 0L; max - j >= step; j += step) { keys.add(f.apply(j)); } keys.add(f.apply(max)); Assertions.assertEquals(4, keys.size()); } }