Search in sources :

Example 31 with FunctionInterface

use of com.dexels.navajo.expression.api.FunctionInterface in project navajo by Dexels.

the class StandardFunctionsTest method testGetProperty.

@Test
public void testGetProperty() {
    FunctionInterface fi = fff.getInstance(cl, "GetProperty");
    fi.reset();
    Navajo doc = createTestNavajo();
    fi.setInMessage(doc);
    fi.insertMessageOperand(doc.getMessage("Single"));
    fi.insertStringOperand("Selectie");
    Object o = fi.evaluateWithTypeChecking();
    assertNotNull(o);
    assertTrue(Property.class.isInstance(o));
}
Also used : FunctionInterface(com.dexels.navajo.expression.api.FunctionInterface) Navajo(com.dexels.navajo.document.Navajo) Property(com.dexels.navajo.document.Property) Test(org.junit.Test)

Example 32 with FunctionInterface

use of com.dexels.navajo.expression.api.FunctionInterface in project navajo by Dexels.

the class StandardFunctionsTest method testDateAdd.

@Test
public void testDateAdd() {
    FunctionInterface fi = fff.getInstance(cl, "DateAdd");
    fi.reset();
    fi.insertDateOperand(new Date());
    fi.insertIntegerOperand(2);
    fi.insertStringOperand("YEAR");
    Object o = fi.evaluateWithTypeChecking();
    assertNotNull(o);
    assertEquals(Date.class, o.getClass());
}
Also used : FunctionInterface(com.dexels.navajo.expression.api.FunctionInterface) Date(java.util.Date) Test(org.junit.Test)

Example 33 with FunctionInterface

use of com.dexels.navajo.expression.api.FunctionInterface in project navajo by Dexels.

the class StandardFunctionsTest method testParseStringList.

@Test
public void testParseStringList() {
    FunctionInterface fi = fff.getInstance(cl, "ParseStringList");
    fi.reset();
    fi.insertStringOperand("aap,noot,mies");
    fi.insertStringOperand(",");
    Object o = fi.evaluateWithTypeChecking();
    assertNotNull(o);
    assertTrue(List.class.isInstance(o));
}
Also used : FunctionInterface(com.dexels.navajo.expression.api.FunctionInterface) ArrayList(java.util.ArrayList) List(java.util.List) Test(org.junit.Test)

Example 34 with FunctionInterface

use of com.dexels.navajo.expression.api.FunctionInterface in project navajo by Dexels.

the class StandardFunctionsTest method testGetUrlTime.

@Test
public void testGetUrlTime() {
    FunctionInterface fi = fff.getInstance(cl, "GetUrlTime");
    fi.reset();
    fi.insertStringOperand("http://www.dexels.com/index.php");
    Object o = fi.evaluateWithTypeChecking();
    assertNotNull(o);
}
Also used : FunctionInterface(com.dexels.navajo.expression.api.FunctionInterface) Test(org.junit.Test)

Example 35 with FunctionInterface

use of com.dexels.navajo.expression.api.FunctionInterface in project navajo by Dexels.

the class StandardFunctionsTest method testCheckEmail.

@Test
public void testCheckEmail() {
    FunctionInterface fi = fff.getInstance(cl, "CheckEmail");
    fi.reset();
    fi.insertStringOperand("arjen@dexels.com");
    Object o = fi.evaluateWithTypeChecking();
    assertNotNull(o);
    assertEquals(Boolean.class, o.getClass());
}
Also used : FunctionInterface(com.dexels.navajo.expression.api.FunctionInterface) Test(org.junit.Test)

Aggregations

FunctionInterface (com.dexels.navajo.expression.api.FunctionInterface)161 Test (org.junit.Test)153 Navajo (com.dexels.navajo.document.Navajo)26 FunctionDefinition (com.dexels.navajo.expression.api.FunctionDefinition)20 ArrayList (java.util.ArrayList)16 Date (java.util.Date)16 Operand (com.dexels.navajo.document.Operand)10 GiveLongTestFunction (com.dexels.navajo.expression.compiled.GiveLongTestFunction)10 TMLExpressionException (com.dexels.navajo.expression.api.TMLExpressionException)7 CapString (com.dexels.navajo.functions.CapString)7 StringReader (java.io.StringReader)5 ContextExpression (com.dexels.navajo.expression.api.ContextExpression)4 AddTestFunction (com.dexels.navajo.expression.compiled.AddTestFunction)4 Binary (com.dexels.navajo.document.types.Binary)3 CheckInteger (com.dexels.navajo.functions.CheckInteger)3 SimpleDateFormat (java.text.SimpleDateFormat)3 List (java.util.List)3 Message (com.dexels.navajo.document.Message)2 Property (com.dexels.navajo.document.Property)2 ClockTime (com.dexels.navajo.document.types.ClockTime)2