private void assertSyncSpacingHasBoundedExpirations(long firstOffset, LongStream steps, int maximumExpirations) {
        try (FakeOffsetSyncStore store = new FakeOffsetSyncStore()) {
            store.start(true);
            store.sync(tp, firstOffset, firstOffset);
            PrimitiveIterator.OfLong iterator = steps.iterator();
            long offset = firstOffset;
            int lastCount = 1;
            while (iterator.hasNext()) {
                offset += iterator.nextLong();
                assertTrue(offset >= 0, "Test is invalid, offset overflowed");
                store.sync(tp, offset, offset);
                // Invariant A: the latest sync is present
                assertEquals(offset, store.syncFor(tp, 0).upstreamOffset());
                // Invariant D: the earliest sync is present
                assertEquals(firstOffset, store.syncFor(tp, 63).upstreamOffset());
                int count = countDistinctStoredSyncs(store, tp);
                // We are adding one sync, so if the count didn't change, then exactly one sync expired.
                int expiredSyncs = lastCount - count + 1;
                assertTrue(expiredSyncs <= maximumExpirations,
                        "Store expired too many syncs: " + expiredSyncs + " > " + maximumExpirations
                                + " after receiving offset " + offset);
                lastCount = count;
            }
        }
    }
Simulate an OffsetSyncStore receiving a sequence of offset syncs as defined by their start offset and gaps.
After processing each simulated sync, assert that the store has not expired more unique syncs than the bound.
@param firstOffset First offset to give to the sync store after starting
@param steps A finite stream of gaps between syncs with some known distribution
@param maximumExpirations The maximum number of distinct syncs allowed to be expired after a single update.
connect/mirror/src/test/java/org/apache/kafka/connect/mirror/OffsetSyncStoreTest.java