CommandExecutor { public static String buildCommand( String command, String... args ) { StringBuilder builder = new StringBuilder(); builder.append( COMMAND_START ); builder.append( " " ); builder.append( command ); builder.append( " " ); for ( String arg : args ) { builder.append( arg ); builder.append( " " ); } builder.append( COMMAND_END ); return builder.toString(); } private  CommandExecutor( Builder builder ); static String buildCommand( String command, String... args ); void execute( DataOutputStream dataOutputStream ); static final String COMMAND_START; static final String COMMAND_END; }
@Test public void testBuildCommand() { assertThat( CommandExecutor.buildCommand( "test", "12345", "6789" ), equalTo( "[ test 12345 6789 ]" ) ); }