Github user pvillard31 commented on a diff in the pull request:
https://github.com/apache/nifi/pull/2530#discussion_r173719906
--- Diff:
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/groovy/org/apache/nifi/processors/standard/TestFlattenJson.groovy
---
@@ -134,4 +134,44 @@ class TestFlattenJson {
])
}
}
+
+ @Test
+ void testFlattenModeNormal() {
+ def testRunner = TestRunners.newTestRunner(FlattenJson.class)
+ def json = prettyPrint(toJson([
+ first: [
+ second: [
+ third: [
+ "one", "two", "three", "four",
"five"
+ ]
+ ]
+ ]
+ ]))
+
+ testRunner.setValidateExpressionUsage(true);
+ testRunner.setProperty(FlattenJson.FLATTEN_MODE,
FlattenJson.FLATTEN_MODE_NORMAL)
+ baseTest(testRunner, json,5) { parsed ->
+ Assert.assertEquals("Separator not applied.", "one",
parsed["first.second.third[0]"])
+ }
+ }
+
+ @Test
+ void testFlattenModeDotNotation() {
+ def testRunner = TestRunners.newTestRunner(FlattenJson.class)
+ def json = prettyPrint(toJson([
+ first: [
+ second: [
+ third: [
+ "one", "two", "three", "four",
"five"
+ ]
+ ]
+ ]
+ ]))
+
+ testRunner.setValidateExpressionUsage(true);
--- End diff --
not sure this line is required
---