### Question:
BallotBox implements Lifecycle<BallotBoxOptions>, Describer { public boolean setLastCommittedIndex(final long lastCommittedIndex) { boolean doUnlock = true; final long stamp = this.stampedLock.writeLock(); try { if (this.pendingIndex != 0 || !this.pendingMetaQueue.isEmpty()) { Requires.requireTrue(lastCommittedIndex < this.pendingIndex, "Node changes to leader, pendingIndex=%d, param lastCommittedIndex=%d", this.pendingIndex, lastCommittedIndex); return false; } if (lastCommittedIndex < this.lastCommittedIndex) { return false; } if (lastCommittedIndex > this.lastCommittedIndex) { this.lastCommittedIndex = lastCommittedIndex; this.stampedLock.unlockWrite(stamp); doUnlock = false; this.waiter.onCommitted(lastCommittedIndex); } } finally { if (doUnlock) { this.stampedLock.unlockWrite(stamp); } } return true; }  long getLastCommittedIndex(); @Override boolean init(final BallotBoxOptions opts); boolean commitAt(final long firstLogIndex, final long lastLogIndex, final PeerId peer); void clearPendingTasks(); boolean resetPendingIndex(final long newPendingIndex); boolean appendPendingTask(final Configuration conf, final Configuration oldConf, final Closure done); boolean setLastCommittedIndex(final long lastCommittedIndex); @Override void shutdown(); @Override void describe(final Printer out);  }### Answer:
@Test public void testSetLastCommittedIndexLessThan() { assertFalse(this.box.setLastCommittedIndex(-1)); }
@Test public void testSetLastCommittedIndex() { assertEquals(0, this.box.getLastCommittedIndex()); assertTrue(this.box.setLastCommittedIndex(1)); assertEquals(1, this.box.getLastCommittedIndex()); Mockito.verify(this.waiter, Mockito.only()).onCommitted(1); }