Package org.springframework.binding.expression.el

Examples of org.springframework.binding.expression.el.TestBean


  }

  public void testParseBeanEvalExpressionNoParserContext() {
    String expressionString = "value";
    Expression exp = parser.parseExpression(expressionString, null);
    assertEquals("foo", exp.getValue(new TestBean()));
  }
View Full Code Here


  public void testParseEvalExpressionWithContextTypeCoersion() {
    String expressionString = "maximum";
    Expression exp = parser
        .parseExpression(expressionString, new FluentParserContext().expectResult(Integer.class));
    assertEquals(new Integer(2), exp.getValue(new TestBean()));
  }
View Full Code Here

  public void testParseBeanEvalExpressionInvalidELVariable() {
    try {
      String expressionString = "bogus";
      Expression exp = parser.parseExpression(expressionString,
          new FluentParserContext().evaluate(TestBean.class));
      exp.getValue(new TestBean());
      fail("Should have failed");
    } catch (EvaluationException e) {

    }
  }
View Full Code Here

  }

  public void testParseTemplateExpression() {
    String expressionString = "text text text #{value} text text text#{value}";
    Expression exp = parser.parseExpression(expressionString, new FluentParserContext().template());
    TestBean target = new TestBean();
    assertEquals("text text text foo text text textfoo", exp.getValue(target));
  }
View Full Code Here

  public void testParseTemplateExpressionWithVariables() {
    String expressionString = "#{value}#{#max}";
    Expression exp = parser.parseExpression(expressionString,
        new FluentParserContext().template().variable(new ExpressionVariable("max", "maximum")));
    TestBean target = new TestBean();
    assertEquals("foo2", exp.getValue(target)); // TODO:
  }
View Full Code Here

  }

  public void testGetExpressionType() {
    String expressionString = "maximum";
    Expression exp = parser.parseExpression(expressionString, null);
    TestBean context = new TestBean();
    Class<?> clazz = exp.getValueType(context);
    assertTrue(int.class.equals(clazz) || Integer.class.equals(clazz));
  }
View Full Code Here

  }

  public void testGetValueWithCoersion() {
    String expressionString = "maximum";
    Expression exp = parser.parseExpression(expressionString, new FluentParserContext().expectResult(String.class));
    TestBean context = new TestBean();
    assertEquals("2", exp.getValue(context));
  }
View Full Code Here

  public void testGetValueCoersionError() {
    String expressionString = "maximum";
    Expression exp = parser.parseExpression(expressionString,
        new FluentParserContext().expectResult(TestBean.class));
    TestBean context = new TestBean();
    try {
      exp.getValue(context);
      fail("Should have failed with coersion");
    } catch (ValueCoercionException e) {
    }
View Full Code Here

  }

  public void testSetValue() {
    String expressionString = "maximum";
    Expression exp = parser.parseExpression(expressionString, null);
    TestBean context = new TestBean();
    exp.setValue(context, 5);
    assertEquals(5, context.getMaximum());
  }
View Full Code Here

  }

  public void testSetValueWithTypeCoersion() {
    String expressionString = "maximum";
    Expression exp = parser.parseExpression(expressionString, null);
    TestBean context = new TestBean();
    exp.setValue(context, "5");
    assertEquals(5, context.getMaximum());
  }
View Full Code Here

TOP

Related Classes of org.springframework.binding.expression.el.TestBean

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.