### Question:
RouteText extends AbstractProcessor { @Override public Set<Relationship> getRelationships() { return relationships.get(); }  @Override Set<Relationship> getRelationships(); @Override void onPropertyModified(final PropertyDescriptor descriptor, final String oldValue, final String newValue); @OnScheduled void onScheduled(final ProcessContext context); @Override @SuppressWarnings({"unchecked", "rawtypes"}) void onTrigger(final ProcessContext context, final ProcessSession session); static final String ROUTE_ATTRIBUTE_KEY; static final String GROUP_ATTRIBUTE_KEY; static final AllowableValue ROUTE_TO_MATCHING_PROPERTY_NAME; static final AllowableValue ROUTE_TO_MATCHED_WHEN_ALL_PROPERTIES_MATCH; static final AllowableValue ROUTE_TO_MATCHED_WHEN_ANY_PROPERTY_MATCHES; static final AllowableValue STARTS_WITH; static final AllowableValue ENDS_WITH; static final AllowableValue CONTAINS; static final AllowableValue EQUALS; static final AllowableValue MATCHES_REGULAR_EXPRESSION; static final AllowableValue CONTAINS_REGULAR_EXPRESSION; static final AllowableValue SATISFIES_EXPRESSION; static final PropertyDescriptor ROUTE_STRATEGY; static final PropertyDescriptor MATCH_STRATEGY; static final PropertyDescriptor TRIM_WHITESPACE; static final PropertyDescriptor CHARACTER_SET; static final Relationship REL_ORIGINAL; static final Relationship REL_NO_MATCH; static final Relationship REL_MATCH; }### Answer:
@Test public void testRelationships() throws IOException { final TestRunner runner = TestRunners.newTestRunner(new RouteText()); runner.setProperty(RouteText.MATCH_STRATEGY, RouteText.STARTS_WITH); runner.setProperty(RouteText.ROUTE_STRATEGY, RouteText.ROUTE_TO_MATCHED_WHEN_ANY_PROPERTY_MATCHES); runner.setProperty("simple", "start"); runner.run(); Set<Relationship> relationshipSet = runner.getProcessor().getRelationships(); Set<String> expectedRelationships = new HashSet<>(Arrays.asList("matched", "unmatched", "original")); assertEquals(expectedRelationships.size(), relationshipSet.size()); for (Relationship relationship : relationshipSet) { assertTrue(expectedRelationships.contains(relationship.getName())); } runner.setProperty(RouteText.ROUTE_STRATEGY, RouteText.ROUTE_TO_MATCHING_PROPERTY_NAME); relationshipSet = runner.getProcessor().getRelationships(); expectedRelationships = new HashSet<>(Arrays.asList("simple", "unmatched", "original")); assertEquals(expectedRelationships.size(), relationshipSet.size()); for (Relationship relationship : relationshipSet) { assertTrue(expectedRelationships.contains(relationship.getName())); } runner.run(); }
@Test public void testNotText() throws IOException { final TestRunner runner = TestRunners.newTestRunner(new RouteText()); runner.setProperty(RouteText.MATCH_STRATEGY, RouteText.STARTS_WITH); runner.setProperty("simple", "start"); Set<Relationship> relationshipSet = runner.getProcessor().getRelationships(); Set<String> expectedRelationships = new HashSet<>(Arrays.asList("simple", "unmatched", "original")); assertEquals(expectedRelationships.size(), relationshipSet.size()); for (Relationship relationship : relationshipSet) { assertTrue(expectedRelationships.contains(relationship.getName())); } runner.enqueue(Paths.get("src/test/resources/simple.jpg")); runner.run(); runner.assertTransferCount("unmatched", 1); runner.assertTransferCount("original", 1); final MockFlowFile outOriginal = runner.getFlowFilesForRelationship("original").get(0); outOriginal.assertContentEquals(Paths.get("src/test/resources/simple.jpg")); }