Item[] intval = { factory.createIntValue(2) };
Item[] doubleval = { factory.createDoubleValue(2.2) };
Value result;
context.getCurrentScope().declareVariable(
new ImmutableExpandedName("", "empty"),
factory.createSequence(empty));
context.getCurrentScope().declareVariable(
new ImmutableExpandedName("", "intval"),
factory.createSequence(intval));
context.getCurrentScope().declareVariable(
new ImmutableExpandedName("", "doubleval"),
factory.createSequence(doubleval));
result = compileExpression("$doubleval + 0.2").evaluate(context);
assertEquals("Operator '+' failed,", 2.2 + 0.2, ((DoubleValue) result)
.asJavaDouble(), 0.0000001);