dan-s1 commented on code in PR #9785:
URL: https://github.com/apache/nifi/pull/9785#discussion_r1998895298
##########
nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-processors/src/test/java/org/apache/nifi/processors/jolt/TestJoltTransformJSON.java:
##########
@@ -464,6 +468,57 @@ void testJoltSpecInvalidEL() throws IOException {
runner.assertNotValid();
}
+ private static Stream<Arguments> provideJsonSourceAttributeArguments() {
+ String INVALID_INPUT_JSON =
"{\"rating\":{\"primary\":{\"value\":3},\"series\":{\"value\":[5,4]},\"quality\":{\"value\":}}}";
+ String EXPECTED_JSON =
"{\"rating\":{\"primary\":{\"value\":3},\"series\":{\"value\":[5,4]},\"quality\":{\"value\":3}}}";
+
+ return Stream.of(
+ Arguments.of(JSON_SOURCE_ATTR_NAME, null, SHIFTR_SPEC_PATH,
+ JoltTransformStrategy.SHIFTR, false, null),
+ Arguments.of(JSON_SOURCE_ATTR_NAME,
Map.of(JSON_SOURCE_ATTR_NAME, INVALID_INPUT_JSON), SHIFTR_SPEC_PATH,
+ JoltTransformStrategy.SHIFTR, false, null),
+ Arguments.of("${dynamicJsonAttr}", Map.of("dynamicJsonAttr",
JSON_SOURCE_ATTR_NAME, JSON_SOURCE_ATTR_NAME, EXPECTED_JSON), SHIFTR_SPEC_PATH,
+ JoltTransformStrategy.SHIFTR, true,
SHIFTR_JSON_OUTPUT),
+ Arguments.of(JSON_SOURCE_ATTR_NAME,
Map.of(JSON_SOURCE_ATTR_NAME, EXPECTED_JSON), CHAINR_SPEC_PATH,
+ JoltTransformStrategy.CHAINR, true, CHAINR_JSON_OUTPUT)
+ );
Review Comment:
@Srilatha-ramreddy Thanks for adding the `ParamaterizedTest`. That is what I
had in mind. I am requesting one minor change, instead of using` Arguments.of`
please use `Arguments.argumentSet` so you can give a meaningful name to each of
the tests. I was going to start from the original names of the unit tests you
had started with although I no longer see that commit as it seems you squashed
it. Please note in general once the PR has been submitted no squashes should be
done. Thanks!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]