use of org.seasar.doma.internal.expr.ExpressionEvaluator in project doma by domaframework.
the class MethodOperatorNodeTest method testOneParameter.
@Test
public void testOneParameter() {
MethodOperatorNode node = new MethodOperatorNode(location, ".equals", "equals");
node.setTargetObjectNode(new VariableNode(location, "hoge"));
CommaOperatorNode commaOperatorNode = new CommaOperatorNode(location, ",");
commaOperatorNode.addNode(new LiteralNode(location, "\"aaa\"", "aaa", String.class));
node.setParametersNode(commaOperatorNode);
ExpressionEvaluator evaluator = new ExpressionEvaluator();
evaluator.add("hoge", new Value(String.class, "aaa"));
EvaluationResult evaluationResult = evaluator.evaluate(node);
assertTrue(evaluationResult.getBooleanValue());
}
use of org.seasar.doma.internal.expr.ExpressionEvaluator in project doma by domaframework.
the class NotOperatorNodeTest method test_null.
@Test
public void test_null() {
NotOperatorNode node = new NotOperatorNode(location, "!");
node.setNode(nullLiteral);
ExpressionEvaluator evaluator = new ExpressionEvaluator();
EvaluationResult evaluationResult = evaluator.evaluate(node);
assertTrue(evaluationResult.getBooleanValue());
}
use of org.seasar.doma.internal.expr.ExpressionEvaluator in project doma by domaframework.
the class NotOperatorNodeTest method test_true.
@Test
public void test_true() {
NotOperatorNode node = new NotOperatorNode(location, "!");
node.setNode(trueLiteral);
ExpressionEvaluator evaluator = new ExpressionEvaluator();
EvaluationResult evaluationResult = evaluator.evaluate(node);
assertFalse(evaluationResult.getBooleanValue());
}
Aggregations