### Question:
Usage { public void print( Consumer<String> output ) { output.accept( format( "usage: %s <command>", scriptName ) ); output.accept( "" ); output.accept( "Manage your Neo4j instance." ); output.accept( "" ); printEnvironmentVariables( output ); output.accept( "available commands:" ); printCommands( output ); output.accept( "" ); output.accept( format( "Use %s help <command> for more details.", scriptName ) ); } Usage( String scriptName, CommandLocator commands ); void printUsageForCommand( AdminCommand.Provider command, Consumer<String> output ); void print( Consumer<String> output );  }### Answer:
@Test void shouldPrintUsageWithConfiguration() { AdminCommand.Provider[] commands = new AdminCommand.Provider[]{mockCommand( "bam", "A summary", AdminCommandSection.general() )}; final Usage usage = new Usage( "neo4j-admin", new CannedLocator( commands ) ); usage.print( out ); InOrder ordered = inOrder( out ); ordered.verify( out ).accept( "usage: neo4j-admin <command>" ); ordered.verify( out ).accept( "" ); ordered.verify( out ).accept( "Manage your Neo4j instance." ); ordered.verify( out ).accept( "" ); ordered.verify( out ).accept( "environment variables:" ); ordered.verify( out ).accept( " NEO4J_CONF Path to directory which contains neo4j.conf." ); ordered.verify( out ).accept( " NEO4J_DEBUG Set to anything to enable debug output." ); ordered.verify( out ).accept( " NEO4J_HOME Neo4j home directory." ); ordered.verify( out ).accept( " HEAP_SIZE Set JVM maximum heap size during command execution." ); ordered.verify( out ).accept( " Takes a number and a unit, for example 512m." ); ordered.verify( out ).accept( "" ); ordered.verify( out ).accept( "available commands:" ); ordered.verify( out ).accept( "General" ); ordered.verify( out ).accept( " bam" ); ordered.verify( out ).accept( " A summary" ); ordered.verify( out ).accept( "" ); ordered.verify( out ).accept( "Use neo4j-admin help <command> for more details." ); ordered.verifyNoMoreInteractions(); }
@Test void commandsUnderSameAdminCommandSectionPrintableSectionShouldAppearTogether() { AdminCommand.Provider[] commands = new AdminCommand.Provider[]{ mockCommand( "first-command", "first-command", AdminCommandSection.general() ), mockCommand( "second-command", "second-command", new TestGeneralSection() )}; final Usage usage = new Usage( "neo4j-admin", new CannedLocator( commands ) ); usage.print( out ); InOrder ordered = inOrder( out ); ordered.verify( out ).accept( "usage: neo4j-admin <command>" ); ordered.verify( out ).accept( "" ); ordered.verify( out ).accept( "Manage your Neo4j instance." ); ordered.verify( out ).accept( "" ); ordered.verify( out ).accept( "environment variables:" ); ordered.verify( out ).accept( " NEO4J_CONF Path to directory which contains neo4j.conf." ); ordered.verify( out ).accept( " NEO4J_DEBUG Set to anything to enable debug output." ); ordered.verify( out ).accept( " NEO4J_HOME Neo4j home directory." ); ordered.verify( out ).accept( " HEAP_SIZE Set JVM maximum heap size during command execution." ); ordered.verify( out ).accept( " Takes a number and a unit, for example 512m." ); ordered.verify( out ).accept( "" ); ordered.verify( out ).accept( "available commands:" ); ordered.verify( out ).accept( "General" ); ordered.verify( out ).accept( " first-command" ); ordered.verify( out ).accept( " first-command" ); ordered.verify( out ).accept( " second-command" ); ordered.verify( out ).accept( " second-command" ); ordered.verify( out ).accept( "" ); ordered.verify( out ).accept( "Use neo4j-admin help <command> for more details." ); ordered.verifyNoMoreInteractions(); }