@Test public void testAllCommands() throws Exception { this.app.setDirectory( this.folder.newFolder()); File cmdDir = new File( this.app.getDirectory(), Constants.PROJECT_DIR_COMMANDS ); Assert.assertTrue( cmdDir.mkdirs()); File f = TestUtils.findTestFile( "/commands/single-line-commands.txt" ); Utils.copyStream( f, new File( cmdDir, "single-line-commands" + Constants.FILE_EXT_COMMANDS )); f = TestUtils.findTestFile( "/commands/all-commands.txt" ); CommandsParser parser = new CommandsParser( this.app, f ); List<ParsingError> errors = parser.getParsingErrors(); Assert.assertEquals( 0, errors.size()); }
public List<ParsingError> getParsingErrors() { List<ParsingError> result = new ArrayList<>( this.parsingErrors ); if( this.context.getCommandFile() != null && ! this.context.getCommandFile().exists()) result.add( 0, new ParsingError( ErrorCode.CMD_INEXISTING_COMMAND_FILE, this.context.getCommandFile(), 1 )); else if( this.instructions.isEmpty()) result.add( 0, new ParsingError( ErrorCode.CMD_NO_INSTRUCTION, this.context.getCommandFile(), 1 )); return result; }
CommandsParser { public List<ParsingError> getParsingErrors() { List<ParsingError> result = new ArrayList<>( this.parsingErrors ); if( this.context.getCommandFile() != null && ! this.context.getCommandFile().exists()) result.add( 0, new ParsingError( ErrorCode.CMD_INEXISTING_COMMAND_FILE, this.context.getCommandFile(), 1 )); else if( this.instructions.isEmpty()) result.add( 0, new ParsingError( ErrorCode.CMD_NO_INSTRUCTION, this.context.getCommandFile(), 1 )); return result; } }
CommandsParser { public List<ParsingError> getParsingErrors() { List<ParsingError> result = new ArrayList<>( this.parsingErrors ); if( this.context.getCommandFile() != null && ! this.context.getCommandFile().exists()) result.add( 0, new ParsingError( ErrorCode.CMD_INEXISTING_COMMAND_FILE, this.context.getCommandFile(), 1 )); else if( this.instructions.isEmpty()) result.add( 0, new ParsingError( ErrorCode.CMD_NO_INSTRUCTION, this.context.getCommandFile(), 1 )); return result; } CommandsParser( AbstractApplication app, File commandsFile );  CommandsParser( AbstractApplication app, String instructionsText ); }
CommandsParser { public List<ParsingError> getParsingErrors() { List<ParsingError> result = new ArrayList<>( this.parsingErrors ); if( this.context.getCommandFile() != null && ! this.context.getCommandFile().exists()) result.add( 0, new ParsingError( ErrorCode.CMD_INEXISTING_COMMAND_FILE, this.context.getCommandFile(), 1 )); else if( this.instructions.isEmpty()) result.add( 0, new ParsingError( ErrorCode.CMD_NO_INSTRUCTION, this.context.getCommandFile(), 1 )); return result; } CommandsParser( AbstractApplication app, File commandsFile );  CommandsParser( AbstractApplication app, String instructionsText ); List<ParsingError> getParsingErrors(); List<AbstractCommandInstruction> getInstructions(); static String injectContextVariables( String line, Map<String,String> context ); }
CommandsParser { public List<ParsingError> getParsingErrors() { List<ParsingError> result = new ArrayList<>( this.parsingErrors ); if( this.context.getCommandFile() != null && ! this.context.getCommandFile().exists()) result.add( 0, new ParsingError( ErrorCode.CMD_INEXISTING_COMMAND_FILE, this.context.getCommandFile(), 1 )); else if( this.instructions.isEmpty()) result.add( 0, new ParsingError( ErrorCode.CMD_NO_INSTRUCTION, this.context.getCommandFile(), 1 )); return result; } CommandsParser( AbstractApplication app, File commandsFile );  CommandsParser( AbstractApplication app, String instructionsText ); List<ParsingError> getParsingErrors(); List<AbstractCommandInstruction> getInstructions(); static String injectContextVariables( String line, Map<String,String> context );  }