Example #1
0
  public void testFormatExpression() throws Exception {
    exchange.getIn().setHeader("head", "foo");

    assertEquals(
        "foo", SimpleBuilder.simpleF("${header.%s}", "head").evaluate(exchange, String.class));
    assertNull(SimpleBuilder.simple("${header.cheese}").evaluate(exchange, String.class));
  }
Example #2
0
  public void testFormatExpressionWithResultType() throws Exception {
    exchange.getIn().setHeader("head", "200");

    assertEquals(
        200,
        SimpleBuilder.simpleF("${header.%s}", Integer.class, "head")
            .evaluate(exchange, Object.class));
  }