use of com.dexels.navajo.document.Operand in project navajo by Dexels.
the class TestCompiledMoneyExpression method testAddWithMoney.
@Test
public void testAddWithMoney() {
Operand result;
result = Expression.evaluate("ToMoney(15) + ToMoney(10)", null, null, null);
Assert.assertEquals(new Money(25), result.value);
result = Expression.evaluate("15 + ToMoney(10)", null, null, null);
Assert.assertEquals(new Money(25), result.value);
result = Expression.evaluate("ToMoney(15) + 10", null, null, null);
Assert.assertEquals(new Money(25), result.value);
result = Expression.evaluate("ToLong(15) + ToMoney(10)", null, null, null);
Assert.assertEquals(new Money(25), result.value);
result = Expression.evaluate("ToMoney(15) + ToLong(10)", null, null, null);
Assert.assertEquals(new Money(25), result.value);
result = Expression.evaluate("15.0 + ToMoney(10)", null, null, null);
Assert.assertEquals(new Money(25), result.value);
result = Expression.evaluate("ToMoney(15) + 10.0", null, null, null);
Assert.assertEquals(new Money(25), result.value);
}
use of com.dexels.navajo.document.Operand in project navajo by Dexels.
the class TestCompiledStringExpression method testAddStringAndDouble.
@Test
public void testAddStringAndDouble() {
Operand result = Expression.evaluate("'bla' + 10.0", null, null, null);
assertEquals("bla10.0", result.value);
}
use of com.dexels.navajo.document.Operand in project navajo by Dexels.
the class TestCompiledStringExpression method testAddLongAndString.
@Test
public void testAddLongAndString() {
FunctionInterface giveLongFunction = new GiveLongTestFunction();
FunctionDefinition fd = new FunctionDefinition(giveLongFunction.getClass().getName(), "description", "input", "result");
FunctionFactoryFactory.getInstance().addExplicitFunctionDefinition("ToLong", fd);
Operand result = Expression.evaluate("ToLong(15) + 'bla'", null, null, null);
assertEquals("15bla", result.value);
}
use of com.dexels.navajo.document.Operand in project navajo by Dexels.
the class TestCompiledStringExpression method testAddStringAndInteger.
@Test
public void testAddStringAndInteger() {
Operand result = Expression.evaluate("'bla' + 10", null, null, null);
assertEquals("bla10", result.value);
}
use of com.dexels.navajo.document.Operand in project navajo by Dexels.
the class TestCompiledStringExpression method testAddStringAndLong.
@Test
public void testAddStringAndLong() {
FunctionInterface giveLongFunction = new GiveLongTestFunction();
FunctionDefinition fd = new FunctionDefinition(giveLongFunction.getClass().getName(), "description", "input", "result");
FunctionFactoryFactory.getInstance().addExplicitFunctionDefinition("ToLong", fd);
Operand result = Expression.evaluate("'bla' + ToLong(10)", null, null, null);
assertEquals("bla10", result.value);
}
Aggregations