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

    https://github.com/apache/nifi/pull/778#discussion_r73411049
  
    --- Diff: 
nifi-nar-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/test/java/org/apache/nifi/processors/hadoop/PutHDFSTest.java
 ---
    @@ -199,7 +202,39 @@ public void testPutFile() throws IOException {
             TestRunner runner = TestRunners.newTestRunner(proc);
             runner.setProperty(PutHDFS.DIRECTORY, "target/test-classes");
             runner.setProperty(PutHDFS.CONFLICT_RESOLUTION, "replace");
    -        runner.setValidateExpressionUsage(false);
    +        try (FileInputStream fis = new 
FileInputStream("src/test/resources/testdata/randombytes-1");) {
    +            Map<String, String> attributes = new HashMap<String, String>();
    +            attributes.put(CoreAttributes.FILENAME.key(), "randombytes-1");
    +            runner.enqueue(fis, attributes);
    +            runner.run();
    +        }
    +
    +        Configuration config = new Configuration();
    +        FileSystem fs = FileSystem.get(config);
    +
    +        List<MockFlowFile> failedFlowFiles = runner
    +                .getFlowFilesForRelationship(new 
Relationship.Builder().name("failure").build());
    +        assertTrue(failedFlowFiles.isEmpty());
    +
    +        List<MockFlowFile> flowFiles = 
runner.getFlowFilesForRelationship(PutHDFS.REL_SUCCESS);
    +        assertEquals(1, flowFiles.size());
    --- End diff --
    
    The above assertion that failed flowfiles is empty and that this has size 1 
can be simplified to simply using:
    
    runner.assertAllFlowFilesTransferred(PutHDFS.REL_SUCCESS, 1);


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to