public void testSimple() {
    final OgnlConditionalExpression expression = parse("true ? 0 : 1");
    assertEquals(PsiType.INT, expression.getType());

    final OgnlExpression condition = expression.getCondition();
    assertEquals("true", condition.getText());
    assertElementType(OgnlTypes.LITERAL_EXPRESSION, condition);
    assertEquals(PsiType.BOOLEAN, condition.getType());

    final OgnlExpression thenExpression = expression.getThen();
    assertNotNull(thenExpression);
    assertEquals("0", thenExpression.getText());
    assertElementType(OgnlTypes.LITERAL_EXPRESSION, thenExpression);
    final OgnlLiteralExpression thenLiteral =
        assertInstanceOf(thenExpression, OgnlLiteralExpression.class);
    assertEquals(PsiType.INT, thenLiteral.getType());
    assertEquals(0, thenLiteral.getConstantValue());

    final OgnlExpression elseExpression = expression.getElse();
    assertNotNull(elseExpression);
    assertEquals("1", elseExpression.getText());
    assertElementType(OgnlTypes.LITERAL_EXPRESSION, elseExpression);
    final OgnlLiteralExpression elseLiteral =
        assertInstanceOf(elseExpression, OgnlLiteralExpression.class);
    assertEquals(PsiType.INT, elseLiteral.getType());
    assertEquals(1, elseLiteral.getConstantValue());
  }
 public void testParenthesizedExpressionInThen() {
   final OgnlConditionalExpression expression = parse("true ? (1 + 2) : 1");
   final OgnlExpression thenExpression = expression.getThen();
   assertElementType(OgnlTypes.PARENTHESIZED_EXPRESSION, thenExpression);
 }
 public void testBinaryExpressionInThen() {
   final OgnlConditionalExpression expression = parse("true ? 1 + 2 : 1");
   final OgnlExpression thenExpression = expression.getThen();
   assertElementType(OgnlTypes.BINARY_EXPRESSION, thenExpression);
 }
 public void testVariableExpressionInThen() {
   final OgnlConditionalExpression expression = parse("true ? #this : 1");
   final OgnlExpression thenExpression = expression.getThen();
   assertElementType(OgnlTypes.VARIABLE_EXPRESSION, thenExpression);
 }