Github user justinleet commented on a diff in the pull request:
https://github.com/apache/metron/pull/742#discussion_r137883199
--- Diff:
metron-stellar/stellar-common/src/test/java/org/apache/metron/stellar/dsl/functions/StringFunctionsTest.java
---
@@ -408,6 +408,19 @@ public void testAppendIfMissing() throws Exception {
}
+ @Test
+ public void testSubstring() throws Exception {
+ Map<String, Object> variables = ImmutableMap.of("s", "apache metron");
+ Assert.assertEquals("metron", run("SUBSTRING(s, 7)", variables));
+ Assert.assertEquals("me", run("SUBSTRING(s, 7, 9)", variables));
+ Assert.assertNull(run("SUBSTRING(null, 6, 9)", new HashMap<>()));
--- End diff --
Can you add a test for start being explicitly null, and another one for end
being explicitly null? I mostly care about start being null, since that's a
case not present in Java, given that int can't be null.
---