Package org.springframework.expression

Examples of org.springframework.expression.ExpressionParser


  }

  @Test
  public void SPR9486_floatFunctionResolver() throws Exception {
    Number expectedResult = Math.abs(-10.2f);
    ExpressionParser parser = new SpelExpressionParser();
    SPR9486_FunctionsClass testObject = new SPR9486_FunctionsClass();

    StandardEvaluationContext context = new StandardEvaluationContext();
    Expression expression = parser.parseExpression("abs(-10.2f)");
    Number result = expression.getValue(context, testObject, Number.class);
    assertEquals(expectedResult, result);
  }
View Full Code Here



  @Test
  public void SPR9486_addFloatWithDouble() {
    Number expectedNumber = 10.21f + 10.2;
    ExpressionParser parser = new SpelExpressionParser();
    StandardEvaluationContext context = new StandardEvaluationContext();
    Expression expression = parser.parseExpression("10.21f + 10.2");
    Number result = expression.getValue(context, null, Number.class);
    assertEquals(expectedNumber, result);
  }
View Full Code Here

  }

  @Test
  public void SPR9486_addFloatWithFloat() {
    Number expectedNumber = 10.21f + 10.2f;
    ExpressionParser parser = new SpelExpressionParser();
    StandardEvaluationContext context = new StandardEvaluationContext();
    Expression expression = parser.parseExpression("10.21f + 10.2f");
    Number result = expression.getValue(context, null, Number.class);
    assertEquals(expectedNumber, result);
  }
View Full Code Here

  }

  @Test
  public void SPR9486_subtractFloatWithDouble() {
    Number expectedNumber = 10.21f - 10.2;
    ExpressionParser parser = new SpelExpressionParser();
    StandardEvaluationContext context = new StandardEvaluationContext();
    Expression expression = parser.parseExpression("10.21f - 10.2");
    Number result = expression.getValue(context, null, Number.class);
    assertEquals(expectedNumber, result);
  }
View Full Code Here

  }

  @Test
  public void SPR9486_subtractFloatWithFloat() {
    Number expectedNumber = 10.21f - 10.2f;
    ExpressionParser parser = new SpelExpressionParser();
    StandardEvaluationContext context = new StandardEvaluationContext();
    Expression expression = parser.parseExpression("10.21f - 10.2f");
    Number result = expression.getValue(context, null, Number.class);
    assertEquals(expectedNumber, result);
  }
View Full Code Here

  }

  @Test
  public void SPR9486_multiplyFloatWithDouble() {
    Number expectedNumber = 10.21f * 10.2;
    ExpressionParser parser = new SpelExpressionParser();
    StandardEvaluationContext context = new StandardEvaluationContext();
    Expression expression = parser.parseExpression("10.21f * 10.2");
    Number result = expression.getValue(context, null, Number.class);
    assertEquals(expectedNumber, result);
  }
View Full Code Here

  }

  @Test
  public void SPR9486_multiplyFloatWithFloat() {
    Number expectedNumber = 10.21f * 10.2f;
    ExpressionParser parser = new SpelExpressionParser();
    StandardEvaluationContext context = new StandardEvaluationContext();
    Expression expression = parser.parseExpression("10.21f * 10.2f");
    Number result = expression.getValue(context, null, Number.class);
    assertEquals(expectedNumber, result);
  }
View Full Code Here

  }

  @Test
  public void SPR9486_floatDivideByFloat() {
    Number expectedNumber = -10.21f / -10.2f;
    ExpressionParser parser = new SpelExpressionParser();
    StandardEvaluationContext context = new StandardEvaluationContext();
    Expression expression = parser.parseExpression("-10.21f / -10.2f");
    Number result = expression.getValue(context, null, Number.class);
    assertEquals(expectedNumber, result);
  }
View Full Code Here

  }

  @Test
  public void SPR9486_floatDivideByDouble() {
    Number expectedNumber = -10.21f / -10.2;
    ExpressionParser parser = new SpelExpressionParser();
    StandardEvaluationContext context = new StandardEvaluationContext();
    Expression expression = parser.parseExpression("-10.21f / -10.2");
    Number result = expression.getValue(context, null, Number.class);
    assertEquals(expectedNumber, result);
  }
View Full Code Here

  }

  @Test
  public void SPR9486_floatEqFloatUnaryMinus() {
    Boolean expectedResult = -10.21f == -10.2f;
    ExpressionParser parser = new SpelExpressionParser();
    StandardEvaluationContext context = new StandardEvaluationContext();
    Expression expression = parser.parseExpression("-10.21f == -10.2f");
    Boolean result = expression.getValue(context, null, Boolean.class);
    assertEquals(expectedResult, result);
  }
View Full Code Here

TOP

Related Classes of org.springframework.expression.ExpressionParser

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.