### Question:
NodeBasedComponentRewriteRule extends AbstractNodeBasedRewriteRule implements ComponentRewriteRule { public Set<String> getSlingResourceTypes() throws RepositoryException { Set<String> types = new HashSet<>(); if (!getRuleNode().hasNode("patterns")) { return types; } NodeIterator patterns = getRuleNode().getNode("patterns").getNodes(); while (patterns.hasNext()) { Node pnode = patterns.nextNode(); if (pnode.hasProperty(JcrResourceConstants.SLING_RESOURCE_TYPE_PROPERTY)) { types.add(pnode.getProperty(JcrResourceConstants.SLING_RESOURCE_TYPE_PROPERTY).getString()); } } return types; } NodeBasedComponentRewriteRule(Node ruleNode); Set<String> getSlingResourceTypes();  }### Answer:
@Test public void testGetSlingResourceTypes() throws Exception { Node ruleNode = context.resourceResolver().getResource(RULES_PATH + "/simple").adaptTo(Node.class); NodeBasedComponentRewriteRule rule = new NodeBasedComponentRewriteRule(ruleNode); Set<String> types = rule.getSlingResourceTypes(); assertFalse(types.isEmpty()); assertEquals(1, types.size()); assertEquals("geometrixx/components/simple", types.toArray()[0]); }