use of io.atlasmap.v2.Expression in project atlasmap by atlasmap.
the class ExpressionFieldActionTest method testAnd.
@Test
public void testAnd() throws Exception {
Expression action = new Expression();
action.setExpression("IF(${0} == ${1} && ${0} == ${2}, 'all same', 'not all same')");
assertEquals("all same", ExpressionFieldAction.process(action, Arrays.asList("foo", "foo", "foo")));
assertEquals("all same", ExpressionFieldAction.process(action, Arrays.asList(1, 1, 1)));
assertEquals("not all same", ExpressionFieldAction.process(action, Arrays.asList("foo", "foo", "fo")));
assertEquals("not all same", ExpressionFieldAction.process(action, Arrays.asList(1, 1, 2)));
}
use of io.atlasmap.v2.Expression in project atlasmap by atlasmap.
the class ExpressionFieldActionTest method testMultiply.
@Test
public void testMultiply() throws Exception {
Expression action = new Expression();
action.setExpression("${0} * ${1}");
assertEquals(1000, ExpressionFieldAction.process(action, Arrays.asList(100, 10)));
}
use of io.atlasmap.v2.Expression in project atlasmap by atlasmap.
the class ExpressionFieldActionTest method testTOLOWER.
@Test
public void testTOLOWER() throws Exception {
Expression action = new Expression();
action.setExpression("TOLOWER(${0})");
assertEquals("qwerty", ExpressionFieldAction.process(action, Arrays.asList("qWeRtY")));
}
use of io.atlasmap.v2.Expression in project atlasmap by atlasmap.
the class ExpressionFieldActionTest method testEmptyExpression.
@Test
public void testEmptyExpression() throws Exception {
Expression action = new Expression();
action.setExpression(null);
assertEquals(null, ExpressionFieldAction.process(action, null));
action.setExpression("");
assertEquals(null, ExpressionFieldAction.process(action, null));
action.setExpression(" ");
assertEquals(null, ExpressionFieldAction.process(action, null));
}
use of io.atlasmap.v2.Expression in project atlasmap by atlasmap.
the class ExpressionFieldActionTest method testIFInteger.
@Test
public void testIFInteger() throws Exception {
Expression action = new Expression();
action.setExpression("IF(${0} == 123, 123, 456)");
assertEquals(123, ExpressionFieldAction.process(action, Arrays.asList(123)));
assertEquals(456, ExpressionFieldAction.process(action, Arrays.asList(789)));
}
Aggregations