use of com.dexels.navajo.expression.api.FunctionInterface in project navajo by Dexels.
the class Switch method testWithPropertyAndSingleValueParameter.
@Test
public void testWithPropertyAndSingleValueParameter() throws Exception {
FunctionInterface fi = fff.getInstance(cl, "Switch");
fi.reset();
Navajo n = createTestNavajo();
fi.setInMessage(n);
fi.insertOperand(Expression.evaluate("[/Single/Vuur]", n));
fi.insertIntegerOperand(0);
try {
Object result = fi.evaluate();
} catch (TMLExpressionException tmle) {
assertTrue(tmle.getMessage().indexOf("Not enough") != -1);
}
}
use of com.dexels.navajo.expression.api.FunctionInterface in project navajo by Dexels.
the class Switch method testSingleSimpleMiss.
@Test
public void testSingleSimpleMiss() throws Exception {
FunctionInterface fi = fff.getInstance(cl, "Switch");
fi.reset();
fi.insertIntegerOperand((Integer) Expression.evaluate("20", null).value);
fi.insertIntegerOperand((Integer) Expression.evaluate("10", null).value);
fi.insertIntegerOperand((Integer) Expression.evaluate("-10", null).value);
fi.insertIntegerOperand((Integer) Expression.evaluate("0", null).value);
Object result = fi.evaluate();
assertNotNull(result);
assertEquals(result.getClass(), Integer.class);
assertEquals(Integer.valueOf(0), result);
}
use of com.dexels.navajo.expression.api.FunctionInterface in project navajo by Dexels.
the class Switch method testWithNotEnoughParameters.
@Test
public void testWithNotEnoughParameters() throws Exception {
FunctionInterface fi = fff.getInstance(cl, "Switch");
fi.reset();
Navajo n = createTestNavajo();
fi.setInMessage(n);
fi.insertOperand(Expression.evaluate("[/Single/Vuur]", n));
fi.insertIntegerOperand(20);
fi.insertIntegerOperand(-20);
try {
Object result = fi.evaluate();
} catch (TMLExpressionException tmle) {
assertTrue(tmle.getMessage().indexOf("Not enough") != -1);
}
}
use of com.dexels.navajo.expression.api.FunctionInterface in project navajo by Dexels.
the class Switch method testIntegerMultipleMissInArrayMessage.
@Test
public void testIntegerMultipleMissInArrayMessage() throws Exception {
FunctionInterface fi = fff.getInstance(cl, "Switch");
fi.reset();
Navajo n = createTestNavajo();
fi.setInMessage(n);
fi.insertOperand(Expression.evaluate("[Noot]", n, null, n.getMessage("Aap").getElements().get(0)));
fi.insertIntegerOperand(20);
fi.insertIntegerOperand(-20);
fi.insertIntegerOperand(15);
fi.insertIntegerOperand(-15);
fi.insertIntegerOperand(0);
Object result = fi.evaluate();
assertNotNull(result);
assertEquals(result.getClass(), Integer.class);
assertEquals(Integer.valueOf(0), result);
}
use of com.dexels.navajo.expression.api.FunctionInterface in project navajo by Dexels.
the class Switch method testWithOnlyPropertyParameter.
@Test
public void testWithOnlyPropertyParameter() throws Exception {
FunctionInterface fi = fff.getInstance(cl, "Switch");
fi.reset();
Navajo n = createTestNavajo();
fi.setInMessage(n);
fi.insertOperand(Expression.evaluate("[/Single/Vuur]", n));
try {
Object result = fi.evaluate();
} catch (TMLExpressionException tmle) {
assertTrue(tmle.getMessage().indexOf("Not enough") != -1);
}
}
Aggregations