markap14 commented on a change in pull request #5070:
URL: https://github.com/apache/nifi/pull/5070#discussion_r631331669
##########
File path:
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/groovy/org/apache/nifi/processors/standard/TestPutDatabaseRecord.groovy
##########
@@ -483,6 +483,9 @@ class TestPutDatabaseRecord {
runner.assertTransferCount(PutDatabaseRecord.REL_SUCCESS, 0)
runner.assertTransferCount(PutDatabaseRecord.REL_FAILURE, 1)
+ MockFlowFile flowFile =
runner.getFlowFilesForRelationship(PutDatabaseRecord.REL_FAILURE).get(0);
+ flowFile.assertAttributeEquals('putdatabaserecord.error',
+ 'java.sql.SQLException: Table PERSONS2 not found, ensure the
Catalog, Schema, and/or Table Names match those in the database exactly')
Review comment:
The SQLException that gets thrown here turns into an attribute. But the
text of that Exception is intended for human consumption and can be freely
changed at any time. We should not see test failures just because the text of
an Exception was changed. Probably makes sense to instead make more specific
assertions about the text such as:
```
final String errorMessage = flowFile.getAttribute("putdatabaserecord.error");
assertTrue(errorMessage.contains("PERSONS2");
```
--
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]