### Question:
BallotBox implements Lifecycle<BallotBoxOptions>, Describer { public boolean appendPendingTask(final Configuration conf, final Configuration oldConf, final Closure done) { final Ballot bl = new Ballot(); if (!bl.init(conf, oldConf)) { LOG.error("Fail to init ballot."); return false; } final long stamp = this.stampedLock.writeLock(); try { if (this.pendingIndex <= 0) { LOG.error("Fail to appendingTask, pendingIndex={}.", this.pendingIndex); return false; } this.pendingMetaQueue.add(bl); this.closureQueue.appendPendingClosure(done); return true; } finally { this.stampedLock.unlockWrite(stamp); } }  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 testAppendPendingTask() { assertTrue(this.box.getPendingMetaQueue().isEmpty()); assertTrue(this.closureQueue.getQueue().isEmpty()); assertFalse(this.box.appendPendingTask( JRaftUtils.getConfiguration("localhost:8081,localhost:8082,localhost:8083"), JRaftUtils.getConfiguration("localhost:8081"), new Closure() { @Override public void run(Status status) { } })); assertTrue(box.resetPendingIndex(1)); assertTrue(this.box.appendPendingTask( JRaftUtils.getConfiguration("localhost:8081,localhost:8082,localhost:8083"), JRaftUtils.getConfiguration("localhost:8081"), new Closure() { @Override public void run(Status status) { } })); assertEquals(1, this.box.getPendingMetaQueue().size()); assertEquals(1, this.closureQueue.getQueue().size()); }