@Test
public void testSharedBucket() {

    TokenBucketAdmissionController controller = new TokenBucketAdmissionController(
            Collections.singletonList(SHARED_ANY_CONFIGURATION),
            titusRuntime
    );
    AdmissionControllerRequest request = AdmissionControllerRequest.newBuilder()
            .withCallerId("any")
            .withEndpointName("any")
            .build();
    // We assume the loop below will complete in a sec so we account for single refill only.
    int limit = SHARED_ANY_CONFIGURATION.getCapacity() + SHARED_ANY_CONFIGURATION.getRefillRateInSec() + 1;
    int stoppedAt = 0;
    while (stoppedAt < limit) {
        AdmissionControllerResponse response = controller.apply(request);
        if (!response.isAllowed()) {
            break;
        }
        stoppedAt++;
    }
    assertThat(stoppedAt).isGreaterThanOrEqualTo(SHARED_ANY_CONFIGURATION.getCapacity());
    assertThat(stoppedAt).isLessThan(limit);
}