diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestRouteText.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestRouteText.java index 760986df5a..7c40445666 100644 --- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestRouteText.java +++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestRouteText.java @@ -132,6 +132,42 @@ public class TestRouteText { outUnmatched.assertContentEquals("not match".getBytes("UTF-8")); } + @Test + public void testSimpleCaseSensitiveStartsMatch() throws IOException { + final TestRunner runner = TestRunners.newTestRunner(new RouteText()); + runner.setProperty(RouteText.MATCH_STRATEGY, RouteText.STARTS_WITH); + runner.setProperty(RouteText.IGNORE_CASE, "false"); + runner.setProperty("simple", "start"); + + runner.enqueue("STart middle end\nstart middle end".getBytes("UTF-8")); + runner.run(); + + runner.assertTransferCount("simple", 1); + runner.assertTransferCount("unmatched", 1); + runner.assertTransferCount("original", 1); + final MockFlowFile outMatched = runner.getFlowFilesForRelationship("simple").get(0); + outMatched.assertContentEquals("start middle end".getBytes("UTF-8")); + final MockFlowFile outUnmatched = runner.getFlowFilesForRelationship("unmatched").get(0); + outUnmatched.assertContentEquals("STart middle end\n".getBytes("UTF-8")); + } + + @Test + public void testSimpleCaseInsensitiveStartsMatch() throws IOException { + final TestRunner runner = TestRunners.newTestRunner(new RouteText()); + runner.setProperty(RouteText.MATCH_STRATEGY, RouteText.STARTS_WITH); + runner.setProperty(RouteText.IGNORE_CASE, "true"); + runner.setProperty("simple", "start"); + + runner.enqueue("start middle end\nSTart middle end".getBytes("UTF-8")); + runner.run(); + + runner.assertTransferCount("simple", 1); + runner.assertTransferCount("unmatched", 0); + runner.assertTransferCount("original", 1); + final MockFlowFile outMatched = runner.getFlowFilesForRelationship("simple").get(0); + outMatched.assertContentEquals("start middle end\nSTart middle end".getBytes("UTF-8")); + } + @Test public void testSimpleDefaultEnd() throws IOException { final TestRunner runner = TestRunners.newTestRunner(new RouteText());