You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2020/02/26 16:04:10 UTC

[GitHub] [nifi] ottobackwards commented on a change in pull request #4012: NIFI-7055 createListValidator should treat ", " as invalid

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

 ##########
 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:
   No.  The way it works is each item in a produced list is passed to the embedded validator.
   In this case, the split produces ["","foo"].   2 elements.
   The first element is passed to the non-empty validator and fails.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services