ConsumptionProbe implements Serializable { @Override public String toString() { return "ConsumptionResult{" + "consumed=" + consumed + ", remainingTokens=" + remainingTokens + ", nanosToWaitForRefill=" + nanosToWaitForRefill + '}'; } private  ConsumptionProbe(boolean consumed, long remainingTokens, long nanosToWaitForRefill); static ConsumptionProbe consumed(long remainingTokens); static ConsumptionProbe rejected(long remainingTokens, long nanosToWaitForRefill); boolean isConsumed(); long getRemainingTokens(); long getNanosToWaitForRefill(); @Override String toString(); static final SerializationHandle<ConsumptionProbe> SERIALIZATION_HANDLE; }
@Test public void testToString() throws Exception { System.out.println(ConsumptionProbe.consumed(1)); System.out.println(ConsumptionProbe.rejected(-1, 10)); System.out.println(ConsumptionProbe.rejected(0, 10)); }