@Test public void testAndAsString() throws Exception { Condition condition = new Condition(); Expression left = new BinaryExpression(Operator.OR, getVariable("a"), getVariable("b")); Expression right = new BinaryExpression(Operator.OR, getVariable("c"), getVariable("d")); condition.setExpression(new BinaryExpression(Operator.AND, left, right)); GroovyExpression expr = new GroovyExpression(condition); Assert.assertEquals("(a || b) && (c || d)", expr.asString()); }
@Override public String asString() { if (expression == null) { GroovyExpressionTranslator expressionTranslator = new GroovyExpressionTranslator(); condition.getExpression().accept(expressionTranslator); expression = expressionTranslator.getTranslatedExpression(); } return expression; }
GroovyExpression extends ExpressionRuntime { @Override public String asString() { if (expression == null) { GroovyExpressionTranslator expressionTranslator = new GroovyExpressionTranslator(); condition.getExpression().accept(expressionTranslator); expression = expressionTranslator.getTranslatedExpression(); } return expression; } }
GroovyExpression extends ExpressionRuntime { @Override public String asString() { if (expression == null) { GroovyExpressionTranslator expressionTranslator = new GroovyExpressionTranslator(); condition.getExpression().accept(expressionTranslator); expression = expressionTranslator.getTranslatedExpression(); } return expression; } GroovyExpression(Condition condition); }
GroovyExpression extends ExpressionRuntime { @Override public String asString() { if (expression == null) { GroovyExpressionTranslator expressionTranslator = new GroovyExpressionTranslator(); condition.getExpression().accept(expressionTranslator); expression = expressionTranslator.getTranslatedExpression(); } return expression; } GroovyExpression(Condition condition); @Override String asString(); }
GroovyExpression extends ExpressionRuntime { @Override public String asString() { if (expression == null) { GroovyExpressionTranslator expressionTranslator = new GroovyExpressionTranslator(); condition.getExpression().accept(expressionTranslator); expression = expressionTranslator.getTranslatedExpression(); } return expression; } GroovyExpression(Condition condition); @Override String asString();  }