use of com.dexels.navajo.document.Navajo 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.document.Navajo 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.document.Navajo 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);
}
}
use of com.dexels.navajo.document.Navajo in project navajo by Dexels.
the class StandardFunctionsTest method testGetFileExtension.
@Test
public void testGetFileExtension() {
FunctionInterface fi = fff.getInstance(cl, "GetFileExtension");
Navajo doc = createTestNavajo();
fi.setInMessage(doc);
fi.reset();
fi.insertOperand(Operand.NULL);
Object o = fi.evaluateWithTypeChecking();
assertNull(o);
}
use of com.dexels.navajo.document.Navajo in project navajo by Dexels.
the class StandardFunctionsTest method testSumMessage.
@Test
public void testSumMessage() {
FunctionInterface fi = fff.getInstance(cl, "SumMessage");
Navajo doc = createTestNavajo();
fi.setInMessage(doc);
fi.reset();
fi.insertMessageOperand(doc.getMessage("Aap"));
fi.insertStringOperand("Noot");
Object o = fi.evaluateWithTypeChecking();
assertNotNull(o);
assertEquals(Integer.class, o.getClass());
assertEquals("10", o.toString());
}
Aggregations