You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by JPercivall <gi...@git.apache.org> on 2016/09/15 16:08:43 UTC

[GitHub] nifi pull request #803: nifi-1214c Mock Framework should allow order-indepen...

Github user JPercivall commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/803#discussion_r78998108
  
    --- Diff: nifi-mock/src/main/java/org/apache/nifi/util/MockFlowFile.java ---
    @@ -290,4 +291,18 @@ public long getLineageStartIndex() {
         public long getQueueDateIndex() {
             return 0;
         }
    +
    +    public boolean isAttributeEqual(final String attributeName, final String expectedValue) {
    +        // unknown attribute name, so cannot be equal.
    +        if (attributes.containsKey(attributeName) == false)
    +            return false;
    +
    +        String value = attributes.get(attributeName);
    +        return Objects.equals(expectedValue, value);
    +    }
    +
    +    public boolean isContentEqual(String excpected) {
    +        final String value = new String(this.data, Charset.forName("UTF-8"));
    +        return Objects.equals(excpected, value);
    --- End diff --
    
    Instead of comparing a String to binary data (and forcing the "UTF-8" character encoding), I think it would be better to have the parameter be a byte[] and do Arrays.equal() on them. Thoughts? 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---