Search in sources :

Example 1 with LastIndexOf

use of io.atlasmap.v2.LastIndexOf in project atlasmap by atlasmap.

the class StringComplexFieldActionsTest method testLastIndexOf.

@Test
public void testLastIndexOf() {
    LastIndexOf action = new LastIndexOf();
    action.setString("");
    assertEquals(-1, StringComplexFieldActions.lastIndexOf(action, null));
    assertEquals(0, StringComplexFieldActions.lastIndexOf(action, ""));
    assertEquals(3, StringComplexFieldActions.lastIndexOf(action, "foo"));
    action.setString("bar");
    assertEquals(-1, StringComplexFieldActions.lastIndexOf(action, null));
    assertEquals(-1, StringComplexFieldActions.lastIndexOf(action, ""));
    assertEquals(-1, StringComplexFieldActions.lastIndexOf(action, "foo"));
    assertEquals(3, StringComplexFieldActions.lastIndexOf(action, "foobar"));
    assertEquals(6, StringComplexFieldActions.lastIndexOf(action, "foobarbar"));
}
Also used : LastIndexOf(io.atlasmap.v2.LastIndexOf) Test(org.junit.Test)

Aggregations

LastIndexOf (io.atlasmap.v2.LastIndexOf)1 Test (org.junit.Test)1