CommandLineOptions { public void printHelp() { HelpFormatter formatter = new HelpFormatter(); formatter.printHelp("vespa-stat [options]", "Fetch statistics about a specific user, group, bucket, gid or document.", options, "", false); }  void printHelp(); ClientParameters parseCommandLineArguments(String[] args);  }
@Test public void testPrintHelp() { ByteArrayOutputStream outContent = new ByteArrayOutputStream(); PrintStream oldOut = System.out; System.setOut(new PrintStream(outContent)); try { CommandLineOptions options = new CommandLineOptions(); options.printHelp(); String output = outContent.toString(); assertTrue(output.contains("vespa-stat [options]")); } finally { System.setOut(oldOut); outContent.reset(); } }