Duration.ofSeconds(5), Duration.ofMinutes(60), new Distribution(Subscriber.MAX_ACK_DEADLINE_SECONDS + 1), flowController, new LinkedList<MessageDispatcher.OutstandingMessageBatch>(),
private Distribution of(Integer... values) { int max = Collections.max(Arrays.asList(values)); Distribution dist = new Distribution(max + 1); for (int value : values) { dist.record(value); } return dist; } }
@Test(expected = IllegalArgumentException.class) public void testZeroMaxValue() { new Distribution(0); }
@Test(expected = IllegalArgumentException.class) public void testNegativeMaxValue() { new Distribution(-1); }
@Test public void testOverflowMaxValue() { // Record value greater than maxValue-1 is OK. We record maxValue-1 instead. Distribution dist = new Distribution(10); dist.record(10); assertThat(dist.getPercentile(100)).isEqualTo(9); }