### Question:
Commands { private static void printHelp() { String cmd = "<CMD>"; String CRLF = "\r\n"; StringWriter subCommandsHelp = new StringWriter(); commands.stream().map(it -> { CommandDescriptor cDesc = it.getAnnotation(CommandDescriptor.class); return format("%s (%s)", cDesc.name(), cDesc.type());}) .sorted().forEach(subcmd -> subCommandsHelp.append(StringUtils.repeat(' ', 4)) .append(subcmd) .append(CRLF) ); String cmdLineSyntax = format("%s [COMMON_OPTIONS...] <subcommand> [SUBCOMMAND_OPTIONS] <parameters...>", cmd); String header = "Manages communication with the SAP CM System.\r\nCOMMON OPTIONS:"; String footer = format("Subcommands:%s%s%sType '%s <subcommand> --help' for more details.%s", CRLF, subCommandsHelp.toString(), CRLF, cmd, CRLF); new HelpFormatter().printHelp( cmdLineSyntax, header, Helpers.getStandardOptions(), footer); }  final static void main(String[] args);  }### Answer:
@Test public void testPrintHelp() throws Exception { Commands.main(new String[] {"--help"}); String help = IOUtils.toString(result.toByteArray(), "UTF-8"); assertThat(help, Matchers.containsString("Prints this help.")); }