@Test public void testInvalidOperandsTypeToOperatorLessThan() throws IOException { Messages messages = new Messages(); TypeChecker typeChecker = new TypeChecker(messages); LessThan lessThan = new LessThan(2, new StringerLiteral(2, "test"), new IntegerLiteral(2, 111)); typeChecker.visit(lessThan); assertEquals(1, messages.getErrors().size()); assertEquals(0, messages.getWarnings().size()); assertThat(messages.getErrors().get(0), instanceOf(InvalidOperandsTypeToOperator.class)); }
@Override public Void visit(Form node) { for (Item item : node.getQuestions()) { item.accept(this); } return null; }
TypeChecker implements FormVisitor<Void>, ItemVisitor<Void>, ExpressionVisitor<ValueType> { @Override public Void visit(Form node) { for (Item item : node.getQuestions()) { item.accept(this); } return null; } }
TypeChecker implements FormVisitor<Void>, ItemVisitor<Void>, ExpressionVisitor<ValueType> { @Override public Void visit(Form node) { for (Item item : node.getQuestions()) { item.accept(this); } return null; } TypeChecker(Messages messages); }
TypeChecker implements FormVisitor<Void>, ItemVisitor<Void>, ExpressionVisitor<ValueType> { @Override public Void visit(Form node) { for (Item item : node.getQuestions()) { item.accept(this); } return null; } TypeChecker(Messages messages); @Override Void visit(Form node); @Override Void visit(Question node); @Override Void visit(ComputedQuestion computedQuestion); @Override Void visit(IfThen node); @Override Void visit(IfThenElse node); @Override ValueType visit(GroupedExpression node); @Override ValueType visit(Identifier identifier); @Override ValueType visit(StringerLiteral stringerLiteral); @Override ValueType visit(IntegerLiteral integerLiteral); @Override ValueType visit(BooleanLiteral booleanLiteral); @Override ValueType visit(Expression expression); @Override ValueType visit(Addition addition); @Override ValueType visit(Division division); @Override ValueType visit(Equal equal); @Override ValueType visit(GreaterThan greaterThan); @Override ValueType visit(GreaterThanOrEqual greaterThanOrEqual); @Override ValueType visit(LessThan lessThan); @Override ValueType visit(LessThanOrEqual lessThanOrEqual); @Override ValueType visit(LogicalAnd logicalAnd); @Override ValueType visit(LogicalOr logicalOr); @Override ValueType visit(Multiplication multiplication); @Override ValueType visit(NotEqual notEqual); @Override ValueType visit(Subtraction subtraction); }
TypeChecker implements FormVisitor<Void>, ItemVisitor<Void>, ExpressionVisitor<ValueType> { @Override public Void visit(Form node) { for (Item item : node.getQuestions()) { item.accept(this); } return null; } TypeChecker(Messages messages); @Override Void visit(Form node); @Override Void visit(Question node); @Override Void visit(ComputedQuestion computedQuestion); @Override Void visit(IfThen node); @Override Void visit(IfThenElse node); @Override ValueType visit(GroupedExpression node); @Override ValueType visit(Identifier identifier); @Override ValueType visit(StringerLiteral stringerLiteral); @Override ValueType visit(IntegerLiteral integerLiteral); @Override ValueType visit(BooleanLiteral booleanLiteral); @Override ValueType visit(Expression expression); @Override ValueType visit(Addition addition); @Override ValueType visit(Division division); @Override ValueType visit(Equal equal); @Override ValueType visit(GreaterThan greaterThan); @Override ValueType visit(GreaterThanOrEqual greaterThanOrEqual); @Override ValueType visit(LessThan lessThan); @Override ValueType visit(LessThanOrEqual lessThanOrEqual); @Override ValueType visit(LogicalAnd logicalAnd); @Override ValueType visit(LogicalOr logicalOr); @Override ValueType visit(Multiplication multiplication); @Override ValueType visit(NotEqual notEqual); @Override ValueType visit(Subtraction subtraction);  }