Package org.springframework.binding.expression

Examples of org.springframework.binding.expression.Expression


    assertEquals("false0", exp.getValue(bean));
  }

  public void testGetExpressionString() {
    String expressionString = "maximum";
    Expression exp = parser.parseExpression(expressionString, null);
    assertEquals("maximum", exp.getExpressionString());
  }
View Full Code Here


    assertEquals("maximum", exp.getExpressionString());
  }

  public void testGetValueType() {
    String exp = "flag";
    Expression e = parser.parseExpression(exp, null);
    assertEquals(boolean.class, e.getValueType(bean));
  }
View Full Code Here

    assertEquals(boolean.class, e.getValueType(bean));
  }

  public void testGetValueTypeNullCollectionValue() {
    String exp = "list[0]";
    Expression e = parser.parseExpression(exp, null);
    assertEquals(null, e.getValueType(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");
    } catch (ValueCoercionException e) {
    }
  }
View Full Code Here

    }
  }

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

    exp.setValue(context, new Integer(5));
    assertEquals(5, context.getNumber());
  }

  public void testSetValueWithCoersion() {
    Expression e = parser.parseExpression("date", null);
    e.setValue(bean, "2008-9-15");
  }
View Full Code Here

    Expression e = parser.parseExpression("date", null);
    e.setValue(bean, "2008-9-15");
  }

  public void testSetBogusValueWithCoersion() {
    Expression e = parser.parseExpression("date", null);
    try {
      e.setValue(bean, "bogus");
      fail("Should have failed tme");
    } catch (ValueCoercionException ex) {
    }
  }
View Full Code Here

    }
  }

  public void testReasonCauseLinkingGetValue() {
    String exp = "getException()";
    Expression e = parser.parseExpression(exp, null);
    try {
      e.getValue(bean);
    } catch (EvaluationException ex) {
      assertTrue(ex.getCause().getCause() instanceof IllegalStateException);
    }
  }
View Full Code Here

    }
  }

  public void testReasonCauseLinkingSetValue() {
    String exp = "exceptionProperty";
    Expression e = parser.parseExpression(exp, null);
    try {
      e.setValue(bean, "does not matter");
    } catch (EvaluationException ex) {
      assertTrue(ex.getCause().getCause() instanceof IllegalStateException);
    }
  }
View Full Code Here

TOP

Related Classes of org.springframework.binding.expression.Expression

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.