ClientOptions { public void printHelp(PrintStream outputStream) { PrintWriter printWriter = new PrintWriter(outputStream); HelpFormatter helpFormatter = new HelpFormatter(); helpFormatter.printHelp(printWriter, 80, Client.class.getName() + " [options]", "Socket Client Performance Test", options, 3, 1, ""); printWriter.flush(); } ClientOptions(); void parseArguments(String... args); void printHelp(PrintStream outputStream); int getExecutionSeconds(); boolean isHelpRequested(); int getNumberOfThreads(); List<Integer> getPorts(); int getMinimumMessageSize(); int getMaximumMessageSize(); String getIpAddress(); int getMillisPause(); static final String OPTION_HELP; static final String OPTION_EXECUTION_SECONDS; static final String OPTION_NUMBER_OF_THREAD; static final String OPTION_PORTS; static final String OPTION_IP_ADDRESS; static final String OPTION_MILLIS_PAUSE_BETWEEN_EXECUTIONS; static final int DEFAULT_MILLIS_PAUSE_BETWEEN_EXECUTIONS; static final int DEFAULT_NUMBER_OF_THREAD; static final int DEFAULT_EXECUTION_SECONDS; static final String OPTION_MIN_MESSAGE_SIZE; static final String OPTION_MAX_MESSAGE_SIZE; static final int DEFAULT_MIN_MESSAGE_SIZE; static final int DEFAULT_MAX_MESSAGE_SIZE; static final String DEFAULT_IP_ADDRESS; static final Integer DEFAULT_PORT; }
@Test public void testPrintHelp() throws Exception{ ClientOptions clientOptions = new ClientOptions( ); ByteArrayOutputStream os = new ByteArrayOutputStream(); PrintStream printStream = new PrintStream(os); clientOptions.printHelp(printStream); printStream.flush(); assertTrue( os.toString().contains( "-h,--help" )); }