use of javax.el.ExpressionFactory in project jersey by jersey.
the class LinkELContextTest method testLiteralExpression.
@Test
public void testLiteralExpression() {
System.out.println("Literal expression");
ExpressionFactory factory = ExpressionFactory.newInstance();
LinkELContext context = new LinkELContext(new BooleanBean(), null);
ValueExpression expr = factory.createValueExpression(context, "${1+2}", int.class);
Object value = expr.getValue(context);
assertEquals(3, value);
}
use of javax.el.ExpressionFactory in project jersey by jersey.
the class LinkELContextTest method testBooleanExpression.
@Test
public void testBooleanExpression() {
System.out.println("Boolean expression");
ExpressionFactory factory = ExpressionFactory.newInstance();
LinkELContext context = new LinkELContext(new BooleanBean(), null);
ValueExpression expr = factory.createValueExpression(context, "${entity.enabled}", boolean.class);
Object value = expr.getValue(context);
assertEquals(true, value);
expr = factory.createValueExpression(context, "${entity.getValue(true)}", boolean.class);
value = expr.getValue(context);
assertEquals(true, value);
expr = factory.createValueExpression(context, "${entity.getValue(false)}", boolean.class);
value = expr.getValue(context);
assertEquals(false, value);
}
use of javax.el.ExpressionFactory in project jersey by jersey.
the class LinkELContextTest method testExpression.
@Test
public void testExpression() {
System.out.println("Raw expression");
ExpressionFactory factory = ExpressionFactory.newInstance();
LinkELContext context = new LinkELContext(new EntityBean(), null);
ValueExpression expr = factory.createValueExpression(context, "${entity.id}", String.class);
Object value = expr.getValue(context);
assertEquals(ID, value);
}
use of javax.el.ExpressionFactory in project jersey by jersey.
the class LinkELContextTest method testExpressionFactory.
@Test
public void testExpressionFactory() {
System.out.println("Create expression factory");
ExpressionFactory factory = ExpressionFactory.newInstance();
assertNotNull(factory);
}
use of javax.el.ExpressionFactory in project jersey by jersey.
the class LinkELContextTest method testNestedExpression.
@Test
public void testNestedExpression() {
System.out.println("Nested expression");
ExpressionFactory factory = ExpressionFactory.newInstance();
LinkELContext context = new LinkELContext(new OuterEntityBean(), null);
ValueExpression expr = factory.createValueExpression(context, "${entity.inner.id}", String.class);
Object value = expr.getValue(context);
assertEquals(ID, value);
}
Aggregations