@Test public void testValidate_2() throws Exception { File f = TestUtils.findTestFile( "/commands/multi-line-commands.txt" ); CommandsParser parser = new CommandsParser( this.app, f ); Assert.assertEquals( 0, parser.getParsingErrors().size()); Assert.assertEquals( 3, parser.instructions.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 );  }