LineNumberReader lineReader = new LineNumberReader(new InputStreamReader(ExpressionEditorMessageMarshallingTest.class.getResourceAsStream("OneScriptPerLine.txt") ));
String line = null;
List<ConditionExpression> expectedExpressions = new ArrayList<ConditionExpression>();
ConditionExpression expression = new ConditionExpression(ConditionExpression.AND_OPERATOR);
Condition condition = new Condition("between");
condition.addParam("a");
condition.addParam("o\"ne");
condition.addParam("two");
expression.getConditions().add(condition);
expectedExpressions.add(expression);
expression = new ConditionExpression(ConditionExpression.AND_OPERATOR);
condition = new Condition("isNull");
condition.addParam("variable1");
expression.getConditions().add(condition);
expectedExpressions.add(expression);
expression = new ConditionExpression(ConditionExpression.AND_OPERATOR);
condition = new Condition("greaterThan");
condition.addParam("variable2");
condition.addParam(" the value ");
expression.getConditions().add(condition);
expectedExpressions.add(expression);
expression = new ConditionExpression(ConditionExpression.AND_OPERATOR);
condition = new Condition("isNull");
condition.addParam("a");
expression.getConditions().add(condition);
expectedExpressions.add(expression);
expression = new ConditionExpression(ConditionExpression.AND_OPERATOR);
condition = new Condition("greaterOrEqualThan");
condition.addParam("v");
condition.addParam("one");
expression.getConditions().add(condition);
expectedExpressions.add(expression);
while ((line = lineReader.readLine()) != null) {
logger.debug("line(" + lineReader.getLineNumber() + ") :" + line);
ExpressionParser parser = new ExpressionParser(line);
ConditionExpression conditionExpression = parser.parse();
assertEqualsExpression(expectedExpressions.get(lineReader.getLineNumber()-1) , conditionExpression);
}
}