ConsumptionProbe implements Serializable { public long getRemainingTokens() { return remainingTokens; } 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 getRemainingTokens() throws Exception { assertEquals(0, ConsumptionProbe.rejected(-1, 10).getRemainingTokens()); assertEquals(0, ConsumptionProbe.rejected(0, 10).getRemainingTokens()); }