use of com.dexels.navajo.expression.api.FunctionInterface in project navajo by Dexels.
the class StandardFunctionsTest method testEvaluateExpression.
@Test
public void testEvaluateExpression() {
DispatcherFactory.createDispatcher(new TestDispatcher(new TestNavajoConfig()));
FunctionInterface fi = fff.getInstance(cl, "EvaluateExpression");
fi.reset();
Navajo doc = createTestNavajo();
Header h = NavajoFactory.getInstance().createHeader(doc, "aap", "noot", "mies", -1);
doc.addHeader(h);
fi.setInMessage(doc);
fi.insertStringOperand("true");
Object o = fi.evaluateWithTypeChecking();
assertNotNull(o);
}
use of com.dexels.navajo.expression.api.FunctionInterface in project navajo by Dexels.
the class TestAbsFunction method testAbsWithDouble.
@Test
public void testAbsWithDouble() {
FunctionInterface fi = fff.getInstance(cl, "Abs");
fi.reset();
fi.insertFloatOperand(-10.0D);
Object result = fi.evaluateWithTypeChecking();
assertEquals(Double.class, result.getClass());
assertEquals(10, ((Double) result).intValue());
}
use of com.dexels.navajo.expression.api.FunctionInterface in project navajo by Dexels.
the class TestAbsFunction method testAbsWithLong.
@Test
public void testAbsWithLong() {
FunctionInterface fi = fff.getInstance(cl, "Abs");
fi.reset();
fi.insertLongOperand(-10L);
Object result = fi.evaluateWithTypeChecking();
assertEquals(Long.class, result.getClass());
assertEquals(10L, ((Long) result).longValue());
}
use of com.dexels.navajo.expression.api.FunctionInterface in project navajo by Dexels.
the class TestAbsFunction method testAbsWithNoParameters.
@Test(expected = TMLExpressionException.class)
public void testAbsWithNoParameters() {
FunctionInterface fi = fff.getInstance(cl, "Abs");
fi.reset();
fi.evaluateWithTypeChecking();
}
use of com.dexels.navajo.expression.api.FunctionInterface in project navajo by Dexels.
the class StandardFunctionsTest method testGetLogoImage.
@Test
public void testGetLogoImage() {
FunctionInterface fi = fff.getInstance(cl, "GetLogoImage");
Navajo doc = createTestNavajo();
fi.setInMessage(doc);
fi.reset();
fi.insertStringOperand("Logo");
Object o = fi.evaluateWithTypeChecking();
assertNotNull(o);
assertEquals(Binary.class, o.getClass());
}
Aggregations