mattyb149 commented on a change in pull request #4012: NIFI-7055 
createListValidator should treat "," as invalid
URL: https://github.com/apache/nifi/pull/4012#discussion_r384584531
 
 

 ##########
 File path: 
nifi-commons/nifi-utils/src/test/java/org/apache/nifi/util/validator/TestStandardValidators.java
 ##########
 @@ -184,6 +184,25 @@ public void testListValidator() {
         assertFalse(vr.isValid());
         assertEquals(1, mockValidator.getValidateCallCount());
 
+        // An empty list is the same as null, "" or " "
+        vr = val.validate("List", ",", validationContext);
+        assertFalse(vr.isValid());
+        assertEquals(0, mockValidator.getValidateCallCount());
+
+        vr = val.validate("List", " , ", validationContext);
+        assertFalse(vr.isValid());
+        assertEquals(1, mockValidator.getValidateCallCount());
+
+        // will evaluate to no entry
+        vr = val.validate("List", ",,,,", validationContext);
+        assertFalse(vr.isValid());
+        assertEquals(0, mockValidator.getValidateCallCount());
+
+        // will evaluate to an empty element
+        vr = val.validate("List", ",foo", validationContext);
 
 Review comment:
   Since this list has one non-empty element, should it be valid?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to