Package org.springframework.binding.expression.support

Examples of org.springframework.binding.expression.support.FluentParserContext


        "var", "number", new FluentParserContext().expectResult(Long.class))));
    assertEquals(new Long(0), exp.getValue(bean));
  }

  public void testNestedVariablesWithTemplates() {
    Expression exp = parser.parseExpression("#var", new FluentParserContext().variable(new ExpressionVariable(
        "var", "${flag}${#var}", new FluentParserContext().template().variable(
            new ExpressionVariable("var", "number")))));
    assertEquals("false0", exp.getValue(bean));
  }
View Full Code Here


    assertEquals(null, e.getValueType(bean));
  }

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

    assertEquals("0", exp.getValue(context));
  }

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

    }
  }

  public void testParseTemplateSimpleLiteral() {
    String exp = "flag";
    Expression e = parser.parseExpression(exp, new FluentParserContext().template());
    assertNotNull(e);
    assertEquals("flag", e.getValue(bean));
  }
View Full Code Here

    assertNotNull(e);
    assertEquals("flag", e.getValue(bean));
  }

  public void testParseTemplateEmpty() {
    Expression e = parser.parseExpression("", new FluentParserContext().template());
    assertNotNull(e);
    assertEquals("", e.getValue(bean));
  }
View Full Code Here

    assertEquals("", e.getValue(bean));
  }

  public void testParseTemplateComposite() {
    String exp = "hello ${flag} ${flag} ${flag}";
    Expression e = parser.parseExpression(exp, new FluentParserContext().template());
    assertNotNull(e);
    String str = (String) e.getValue(bean);
    assertEquals("hello false false false", str);
  }
View Full Code Here

  }

  public void testTemplateEnclosedCompositeNotSupported() {
    String exp = "${hello ${flag} ${flag} ${flag}}";
    try {
      parser.parseExpression(exp, new FluentParserContext().template());
      fail("Should've failed - not intended use");
    } catch (ParserException e) {
    }
  }
View Full Code Here

      .createExpressionFactory());

  public void testResolveMap() {
    LocalAttributeMap map = new LocalAttributeMap();
    map.put("foo", "bar");
    Expression exp = parser.parseExpression("foo", new FluentParserContext().evaluate(AttributeMap.class));
    Expression exp2 = parser.parseExpression("bogus", new FluentParserContext().evaluate(AttributeMap.class));
    assertEquals("bar", exp.getValue(map));
    assertEquals(null, exp2.getValue(map));
  }
View Full Code Here

  }

  public void testSetMap() {
    LocalAttributeMap map = new LocalAttributeMap();
    map.put("foo", "bar");
    Expression exp = parser.parseExpression("foo", new FluentParserContext().evaluate(MutableAttributeMap.class));
    Expression exp2 = parser
        .parseExpression("bogus", new FluentParserContext().evaluate(MutableAttributeMap.class));
    exp.setValue(map, "baz");
    exp2.setValue(map, "new");
    assertEquals("baz", exp.getValue(map));
    assertEquals("new", exp2.getValue(map));
  }
View Full Code Here

    assertEquals("new", exp2.getValue(map));
  }

  public void testResolveFlowRequestContext() {
    MockRequestContext context = new MockRequestContext();
    Expression exp = parser.parseExpression("flowRequestContext", new FluentParserContext()
        .evaluate(RequestContext.class));
    assertSame(context, exp.getValue(context));
  }
View Full Code Here

TOP

Related Classes of org.springframework.binding.expression.support.FluentParserContext

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.