[
https://issues.apache.org/jira/browse/METRON-586?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15718302#comment-15718302
]
ASF GitHub Bot commented on METRON-586:
---------------------------------------
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);
...
```
> STELLAR should have FILL_LEFT and FILL_RIGHT functions
> ------------------------------------------------------
>
> Key: METRON-586
> URL: https://issues.apache.org/jira/browse/METRON-586
> Project: Metron
> Issue Type: Improvement
> Affects Versions: 0.3.0
> Reporter: Otto Fowler
>
> Stellar should support functions for filling string fields, left or right
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)