input = TupleFactory.getInstance().newTuple(inputStrSpaceRight);
expected = inputStr;
output = strFunc.exec(input);
assertTrue(output.equals(expected));
STRSPLIT splitter = new STRSPLIT();
Tuple test1 = TupleFactory.getInstance().newTuple(1);
Tuple test2 = TupleFactory.getInstance().newTuple(2);
Tuple test3 = TupleFactory.getInstance().newTuple(3);
test2.set(0, "foo");
test2.set(1, ":");
Tuple splits = splitter.exec(test2);
assertEquals("no matches should return tuple with original string", 1, splits.size());
assertEquals("no matches should return tuple with original string", "foo",
splits.get(0));
// test default delimiter
test1.set(0, "f ooo bar");
splits = splitter.exec(test1);
assertEquals("split on default value ", 3, splits.size());
assertEquals("f", splits.get(0));
assertEquals("ooo", splits.get(1));
assertEquals("bar", splits.get(2));
// test trimming of whitespace
test1.set(0, "foo bar ");
splits = splitter.exec(test1);
assertEquals("whitespace trimmed if no length arg", 2, splits.size());
// test forcing null matches with length param
test3.set(0, "foo bar ");
test3.set(1, "\\s");
test3.set(2, 10);
splits = splitter.exec(test3);
assertEquals("length forces empty string matches on end", 5, splits.size());
// test limiting results with limit
test3.set(0, "foo:bar:baz");
test3.set(1, ":");
test3.set(2, 2);
splits = splitter.exec(test3);
assertEquals(2, splits.size());
assertEquals("foo", splits.get(0));
assertEquals("bar:baz", splits.get(1));
Tuple t1 = TupleFactory.getInstance().newTuple(3);