### Question:
OptionParser { void printUsage() { Options options = getCmdLineOptions(); String usage = TOOL_NAME + " [options] <log-directory>"; String header = "Print ecAudit Chronicle logs to standard output."; new HelpFormatter().printHelp(usage, header, options, ""); }    }### Answer:
@Test public void printHelp() { PrintStream originalOut = System.out; ByteArrayOutputStream testOut = new ByteArrayOutputStream(); System.setOut(new PrintStream(testOut)); try { parser.printUsage(); } finally { System.setOut(originalOut); } assertThat(testOut.toString()).contains("eclog"); assertThat(testOut.toString()).contains("follow"); assertThat(testOut.toString()).contains("roll-cycle"); assertThat(testOut.toString()).contains("help"); }