Github user nickwallen commented on a diff in the pull request:
https://github.com/apache/incubator-metron/pull/370#discussion_r90759606
--- Diff:
metron-platform/metron-common/src/test/java/org/apache/metron/common/stellar/StellarTest.java
---
@@ -593,6 +595,39 @@ public void testStringFunctions_advanced() throws
Exception {
}
@Test
+ public void testLeftRightFills() throws Exception{
+ final Map<String, Object> variableMap = new HashMap<String, Object>()
{{
+ put("foo", null);
+ put("bar", null);
+ put("notInt","oh my");
+ }};
+
+ Object left = run("FILL_LEFT('123','X', 10)",new HashedMap());
+ Object right = run("FILL_RIGHT('123','X', 10)", new HashedMap());
+ Object same = run("FILL_RIGHT('123','X', 3)", new HashedMap());
+ Object nullIn = run("FILL_RIGHT('123',foo,bar)", variableMap);
+ Object notInt= run("FILL_RIGHT('123',foo, notInt)", variableMap);
--- End diff --
I don't fully get the order of your tests. The tests get executed above,
but all validated below. It might be more clear to run the test, then validate
it on the next line. At least to me that would be more understandable.
```
// test fill left
Object left = run("FILL_LEFT('123','X', 10)",new HashedMap());
Assert.assertNotNull(left);
Assert.assertEquals(10,((String)left).length());
Assert.assertEquals("XXXXXXX123",(String)left);
// test fill right
Object right = run("FILL_RIGHT('123','X', 10)", new HashedMap());
Assert.assertNotNull(right);
Assert.assertEquals(10,((String)right).length());
Assert.assertEquals("123XXXXXXX",(String)right);
...
```
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---