@Test
public void testTokenBucketIsRecreatedIfConfigurationChanges() {

    settableConfig.setProperty("junit.initialNumberOfTokens", "1");
    settableConfig.setProperty("junit.capacity", "1");
    settableConfig.setProperty("junit.numberOfTokensPerInterval", "0");
    TokenBucket first = supplier.get();
    assertThat(first.tryTake()).isTrue();
    assertThat(first.tryTake()).isFalse();
    settableConfig.setProperty("junit.initialNumberOfTokens", "2");
    settableConfig.setProperty("junit.capacity", "2");
    TokenBucket second = supplier.get();
    assertThat(first != second).isTrue();
    assertThat(second.tryTake()).isTrue();
    assertThat(second.tryTake()).isTrue();
    assertThat(second.tryTake()).isFalse();
    assertThat(buckets).hasSize(3);
    assertThat(buckets.get(1)).isEqualTo(first);
    assertThat(buckets.get(2)).isEqualTo(second);
}