### Question:
ClearedLedgersSet { public TreeSet<Long> gaps() { TreeSet<Long> gaps = new TreeSet<Long>(); int i = 0; long prev = 0; for (Long clearedLedger : clearedLedgers) { if (i++ > 0) { for (long j = prev + 1; j < clearedLedger; j++) { gaps.add(j); } } prev = clearedLedger; } return gaps; }  TreeSet<Long> cleared(); int size(); void clear(long ledger_index); void clearIfNoGaps(); TreeSet<Long> gaps(); boolean okToClear(); boolean contains(long ledger_index); static boolean DEBUG; }### Answer:
@Test public void testGaps() throws Exception { long[] expectedGaps = new long[]{2, 3, 4}; int i = 0; for (Long gap : set.gaps()) { assertEquals(expectedGaps[i++], (long) gap); } }