HelpFormatter { protected void usage(Writer writer) throws IOException { divider(writer); StringBuilder usage = new StringBuilder("Usage:\n"); usage.append(getExecutable()).append(" "); Option option; OptionException exception = getException(); if (exception != null && exception.getOption() != null) { option = exception.getOption(); } else { option = getOption(); } isNotNull(option, "Option is required"); option.help(usage, getUsageOutputHints(), getComparator()); line(writer, usage.toString()); }  void format(OutputStream output); void format(Writer writer); Set<HelpHint> getUsageOutputHints(); void setUsageOutputHints(Set<HelpHint> usageOutputHints); Set<HelpHint> getHelpOutputHints(); void setHelpOutputHints(Set<HelpHint> helpOutputHints); Set<HelpHint> getOptionOutputHints(); void setOptionOutputHints(Set<HelpHint> optionOutputHints); String getExecutable(); void setExecutable(String executable); String getHeader(); void setHeader(String header); String getDivider(); void setDivider(String divider); String getGutter(); void setGutter(String gutter); String getFooter(); void setFooter(String footer); Option getOption(); void setOption(Option option); Comparator getComparator(); void setComparator(Comparator comparator); OptionException getException(); void setException(OptionException exception); final static String GUTTER; static Set<HelpHint> USAGE_OUTPUT_HINTS; static Set<HelpHint> HELP_OUTPUT_HINTS; static Set<HelpHint> OPTION_OUTPUT_HINTS; }
@Test(expectedExceptions = ValidationException.class) public void testUsageNoOption() throws IOException { Writer writer = mock(Writer.class); helpFormatter.usage(writer); }