Source:
<code>public void testTimeBucketKeyExpiry() { final MutableLong purgeLessThanEqualTo = new MutableLong(-2); testMeta.timeBucketAssigner.setExpireBefore(Duration.standardSeconds(1)); testMeta.timeBucketAssigner.setBucketSpan(Duration.standardSeconds(1)); testMeta.timeBucketAssigner.setPurgeListener(new TimeBucketAssigner.PurgeListener() { @Override public void purgeTimeBucketsLessThanEqualTo(long timeBucket) { purgeLessThanEqualTo.setValue(timeBucket); } }); long referenceTime = testMeta.timeBucketAssigner.getReferenceInstant().getMillis(); testMeta.timeBucketAssigner.setup(testMeta.mockManagedStateContext); Assert.assertEquals("purgeLessThanEqualTo", -2L, purgeLessThanEqualTo.longValue()); long time0 = Duration.standardSeconds(0).getMillis() + referenceTime; Assert.assertEquals("time bucket", 1, testMeta.timeBucketAssigner.getTimeBucket(time0) ); testMeta.timeBucketAssigner.endWindow(); Assert.assertEquals("purgeLessThanEqualTo", -1, purgeLessThanEqualTo.longValue()); long time1 = Duration.standardSeconds(9).getMillis() + referenceTime; Assert.assertEquals("time bucket", 10, testMeta.timeBucketAssigner.getTimeBucket(time1) ); testMeta.timeBucketAssigner.endWindow(); Assert.assertEquals("purgeLessThanEqualTo", 8, purgeLessThanEqualTo.longValue()); <START> purgeLessThanEqualTo.setValue(-2); <END> long time2 = Duration.standardSeconds(10).getMillis() + referenceTime; Assert.assertEquals("time bucket", 11, testMeta.timeBucketAssigner.getTimeBucket(time2) ); testMeta.timeBucketAssigner.endWindow(); Assert.assertEquals("purgeLessThanEqualTo", 9, purgeLessThanEqualTo.longValue()); Assert.assertEquals("time bucket", -1, testMeta.timeBucketAssigner.getTimeBucket(time1) ); testMeta.timeBucketAssigner.endWindow(); Assert.assertEquals("purgeLessThanEqualTo", 9, purgeLessThanEqualTo.longValue()); testMeta.timeBucketAssigner.teardown(); }</code><technical_language>remove explicit setting of purgeLessThanEqualTo</technical_language>

Target:
public void testTimeBucketKeyExpiry() { final MutableLong purgeLessThanEqualTo = new MutableLong(-2); testMeta.timeBucketAssigner.setExpireBefore(Duration.standardSeconds(1)); testMeta.timeBucketAssigner.setBucketSpan(Duration.standardSeconds(1)); testMeta.timeBucketAssigner.setPurgeListener(new TimeBucketAssigner.PurgeListener() { @Override public void purgeTimeBucketsLessThanEqualTo(long timeBucket) { purgeLessThanEqualTo.setValue(timeBucket); } }); long referenceTime = testMeta.timeBucketAssigner.getReferenceInstant().getMillis(); testMeta.timeBucketAssigner.setup(testMeta.mockManagedStateContext); Assert.assertEquals("purgeLessThanEqualTo", -2L, purgeLessThanEqualTo.longValue()); long time0 = Duration.standardSeconds(0).getMillis() + referenceTime; Assert.assertEquals("time bucket", 1, testMeta.timeBucketAssigner.getTimeBucket(time0) ); testMeta.timeBucketAssigner.endWindow(); Assert.assertEquals("purgeLessThanEqualTo", -1, purgeLessThanEqualTo.longValue()); long time1 = Duration.standardSeconds(9).getMillis() + referenceTime; Assert.assertEquals("time bucket", 10, testMeta.timeBucketAssigner.getTimeBucket(time1) ); testMeta.timeBucketAssigner.endWindow(); Assert.assertEquals("purgeLessThanEqualTo", 8, purgeLessThanEqualTo.longValue()); long time2 = Duration.standardSeconds(10).getMillis() + referenceTime; Assert.assertEquals("time bucket", 11, testMeta.timeBucketAssigner.getTimeBucket(time2) ); testMeta.timeBucketAssigner.endWindow(); Assert.assertEquals("purgeLessThanEqualTo", 9, purgeLessThanEqualTo.longValue()); Assert.assertEquals("time bucket", -1, testMeta.timeBucketAssigner.getTimeBucket(time1) ); testMeta.timeBucketAssigner.endWindow(); Assert.assertEquals("purgeLessThanEqualTo", 9, purgeLessThanEqualTo.longValue()); testMeta.timeBucketAssigner.teardown(); }