Github user markap14 commented on a diff in the pull request:
https://github.com/apache/nifi/pull/2929#discussion_r210062380
--- Diff:
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestReplaceText.java
---
@@ -404,6 +404,27 @@ public void testRegexWithExpressionLanguageIsEscaped()
throws IOException {
out.assertContentEquals("Hello, World!");
}
+ /**
+ * Test for NIFI-5474
+ */
+ @Test
+ public void testExpressionLanguageInContentIsNotEvaluated() throws
IOException {
+ final TestRunner runner = getRunner();
+ runner.setProperty(ReplaceText.SEARCH_VALUE, "${replaceKey}");
+ runner.setProperty(ReplaceText.REPLACEMENT_VALUE,
"${replaceValue}");
+
+ final Map<String, String> attributes = new HashMap<>();
+ attributes.put("replaceKey", "Hello");
+ attributes.put("replaceValue", "Good-bye");
+
runner.enqueue(Paths.get("src/test/resources/hello_with_expression_like_text.txt"),
attributes);
--- End diff --
Is there a reason that we're using an external file for this? For a simple
case like this i would just use `runner.enqueue("Hello, World! ${DO NOT
EVALUATE}", attributes);`
---