### Question:
HistoryCommand extends Command { @Override public int execute(final String fullCommand, final CommandLine cl, final Shell shellState) throws IOException { if (cl.hasOption(clearHist.getOpt())) { shellState.getReader().getHistory().clear(); } else { Iterator<Entry> source = shellState.getReader().getHistory().entries(); Iterator<String> historyIterator = Iterators.transform(source, input -> String.format("%d: %s", input.index() + 1, input.value())); shellState.printLines(historyIterator, !cl.hasOption(disablePaginationOpt.getOpt())); } return 0; }  @Override int execute(final String fullCommand, final CommandLine cl, final Shell shellState); @Override String description(); @Override int numArgs(); @Override Options getOptions();  }### Answer:
@Test public void testCorrectNumbering() throws IOException { command.execute("", cl, shell); reader.flush(); assertTrue(baos.toString().contains("2: bar")); }