exceptionfactory commented on code in PR #11748:
URL: https://github.com/apache/nifi/pull/11748#discussion_r4186562223


##########
nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestUpdateCounter.java:
##########
@@ -62,6 +63,26 @@ public void testExpressionLanguage() {
         runner.assertAllFlowFilesTransferred(UpdateCounter.SUCCESS, 1);
     }
 
+    @Test
+    public void testAttributes() {
+        runner.setProperty(UpdateCounter.COUNTER_NAME, "firewall");
+        runner.setProperty(UpdateCounter.DELTA, "${num}");
+        runner.setProperty("service", "payments");
+        runner.setProperty("region", "${region}");
+        runner.setProperty("emptyAttribute", "${missingAttribute}");
+
+        final Map<String, String> attributes = Map.of(
+                "num", "5",
+                "region", "us-west"
+        );
+        runner.enqueue(new byte[0], attributes);
+        runner.run();
+
+        assertEquals(5L, runner.getCounterValue("firewall", Map.of("service", 
"payments", "region", "us-west")));

Review Comment:
   It would be helpful to declare the dynamic property names and expected 
values as static final variables, rather than repeating the strings in 
setProperty and Map construction



-- 
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]

Reply via email to