use of org.springframework.expression.spel.standard.SpelExpressionParser in project spring-framework by spring-projects.
the class SpelReproTests method SPR9486_floatGreaterThanFloat.
@Test
public void SPR9486_floatGreaterThanFloat() {
Boolean expectedNumber = -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(expectedNumber, result);
}
use of org.springframework.expression.spel.standard.SpelExpressionParser in project spring-framework by spring-projects.
the class SpelReproTests method SPR9486_floatLessThanOrEqualFloat.
@Test
public void SPR9486_floatLessThanOrEqualFloat() {
Boolean expectedNumber = -10.21f <= -10.22f;
ExpressionParser parser = new SpelExpressionParser();
StandardEvaluationContext context = new StandardEvaluationContext();
Expression expression = parser.parseExpression("-10.21f <= -10.22f");
Boolean result = expression.getValue(context, null, Boolean.class);
assertEquals(expectedNumber, result);
}
use of org.springframework.expression.spel.standard.SpelExpressionParser in project spring-framework by spring-projects.
the class SpelReproTests method indexingAsAPropertyAccess_SPR6968_1.
/** Should be accessing Goo.getKey because 'bar' field evaluates to "key" */
@Test
public void indexingAsAPropertyAccess_SPR6968_1() {
StandardEvaluationContext eContext = new StandardEvaluationContext(new Goo());
String name = null;
Expression expr = null;
expr = new SpelExpressionParser().parseRaw("instance[bar]");
name = expr.getValue(eContext, String.class);
assertEquals("hello", name);
// will be using the cached accessor this time
name = expr.getValue(eContext, String.class);
assertEquals("hello", name);
}
use of org.springframework.expression.spel.standard.SpelExpressionParser in project spring-framework by spring-projects.
the class SpelReproTests method SPR11494.
@Test
@SuppressWarnings("unchecked")
public void SPR11494() {
Expression exp = new SpelExpressionParser().parseExpression("T(java.util.Arrays).asList('a','b')");
List<String> list = (List<String>) exp.getValue();
assertThat(list.size(), is(2));
}
use of org.springframework.expression.spel.standard.SpelExpressionParser in project spring-framework by spring-projects.
the class SpelReproTests method SPR9486_floatGreaterThanEqualDouble.
@Test
public void SPR9486_floatGreaterThanEqualDouble() {
Boolean expectedResult = -10.21f >= -10.2;
ExpressionParser parser = new SpelExpressionParser();
StandardEvaluationContext context = new StandardEvaluationContext();
Expression expression = parser.parseExpression("-10.21f >= -10.2");
Boolean result = expression.getValue(context, null, Boolean.class);
assertEquals(expectedResult, result);
}
Aggregations