mosermw commented on code in PR #10546:
URL: https://github.com/apache/nifi/pull/10546#discussion_r2542334628
##########
nifi-extension-bundles/nifi-enrich-bundle/nifi-enrich-processors/src/test/java/org/apache/nifi/processors/TestGeoEnrichIPRecord.java:
##########
@@ -90,7 +94,28 @@ public void setup() throws Exception {
runner.enableControllerService(registry);
runner.enableControllerService(reader);
runner.enableControllerService(writer);
+ }
+
+ @ParameterizedTest
+ @MethodSource("logLevelArgs")
+ void testInvalidLogLevel(String logLevel, boolean expectValid) {
+ runner.setProperty(AbstractEnrichIP.LOG_LEVEL, logLevel);
+
+ if (expectValid) {
+ runner.assertValid();
+ } else {
+ runner.assertNotValid();
+ }
+ }
+ private static Stream<Arguments> logLevelArgs() {
+ return Stream.of(
+ Arguments.argumentSet("Invalid Log Level Specified",
"GIBBERISH", false),
+ Arguments.argumentSet("Log Level Specified as Expression
Language Expression", "${log.level}", true)
+ );
+ }
Review Comment:
I feel that parameterizing a test with only two cases is unnecessary
cognitive load. This suggestion is much more clear.
```suggestion
@Test
void testInvalidLogLevel() {
runner.setProperty(AbstractEnrichIP.LOG_LEVEL, "GIBBERISH");
runner.assertNotValid();
}
@Test
void testExpressionLanguageLogLevel() {
runner.setProperty(AbstractEnrichIP.LOG_LEVEL, "${log.level}");
runner.assertValid();
}
```
--
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]