Search in sources :

Example 41 with FunctionInterface

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

the class StandardFunctionsTest method testRandom.

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

Example 42 with FunctionInterface

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

the class StandardFunctionsTest method testNow.

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

Example 43 with FunctionInterface

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

the class StandardFunctionsTest method testGetInitials.

@Test
public void testGetInitials() {
    FunctionInterface fi = fff.getInstance(cl, "GetInitials");
    Navajo doc = createTestNavajo();
    fi.setInMessage(doc);
    fi.reset();
    fi.insertStringOperand("aap noot mies");
    Object o = fi.evaluateWithTypeChecking();
    assertNotNull(o);
    assertEquals(String.class, o.getClass());
}
Also used : FunctionInterface(com.dexels.navajo.expression.api.FunctionInterface) Navajo(com.dexels.navajo.document.Navajo) Test(org.junit.Test)

Example 44 with FunctionInterface

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

the class StandardFunctionsTest method testStringStringFunction.

@Test
public void testStringStringFunction() {
    FunctionInterface fi = fff.getInstance(cl, "StringFunction");
    fi.reset();
    fi.insertStringOperand("indexOf");
    fi.insertStringOperand("Apenoot");
    fi.insertStringOperand("n");
    Object o = fi.evaluateWithTypeChecking();
    assertNotNull(o);
    assertEquals(Integer.class, o.getClass());
    fi.reset();
    fi.insertStringOperand("substring");
    fi.insertStringOperand("Apenoot");
    fi.insertIntegerOperand(Integer.valueOf(0));
    fi.insertIntegerOperand(Integer.valueOf(4));
    o = fi.evaluateWithTypeChecking();
    assertNotNull(o);
    assertEquals(String.class, o.getClass());
}
Also used : FunctionInterface(com.dexels.navajo.expression.api.FunctionInterface) Test(org.junit.Test)

Example 45 with FunctionInterface

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

the class StandardFunctionsTest method testCheckFloat.

@Test
public void testCheckFloat() {
    FunctionInterface fi = fff.getInstance(cl, "CheckFloat");
    fi.reset();
    fi.insertFloatOperand(30.0);
    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