CommandLineOptions { public void printHelp() { HelpFormatter formatter = new HelpFormatter(); formatter.printHelp( "vespa-get <options> [documentid...]", "Fetch a document from a Vespa Content cluster.", options, "If one or more document identifier are specified, these documents will be " + "retrieved. Otherwise, document identifiers (separated with line break) will be read from standard in.\n", false); } CommandLineOptions(InputStream stdIn);  CommandLineOptions(); void printHelp(); ClientParameters parseCommandLineArguments(String[] args); static final String HELP_OPTION; static final String PRINTIDS_OPTION; static final String FIELDSET_OPTION; static final String CLUSTER_OPTION; static final String ROUTE_OPTION; static final String CONFIGID_OPTION; static final String SHOWDOCSIZE_OPTION; static final String TIMEOUT_OPTION; static final String NORETRY_OPTION; static final String TRACE_OPTION; static final String PRIORITY_OPTION; static final String LOADTYPE_OPTION; static final String JSONOUTPUT_OPTION; static final String XMLOUTPUT_OPTION; }
@Test public void testPrintHelp() { ByteArrayOutputStream outContent = new ByteArrayOutputStream(); PrintStream oldOut = System.out; System.setOut(new PrintStream(outContent)); try { CommandLineOptions options = new CommandLineOptions(emptyStream); options.printHelp(); String output = outContent.toString(); assertTrue(output.contains("vespa-get <options> [documentid...]")); assertTrue(output.contains("Fetch a document from a Vespa Content cluster.")); } finally { System.setOut(oldOut); outContent.reset(); } }