### Question:
PageRewriteRule implements PageStructureRewriteRule { @Override public boolean matches(Node root) throws RepositoryException { if (!root.hasProperty(NameConstants.NN_TEMPLATE)) { return false; } String template = root.getProperty(NameConstants.NN_TEMPLATE).getString(); return StringUtils.equals(staticTemplate, template); }  @Override boolean matches(Node root); @Override Node applyTo(Node root, Set<Node> finalNodes); @Override String getStaticTemplate(); @Override int getRanking();  }### Answer:
@Test public void testMatches() throws Exception { Node rootNode = context.resourceResolver().getResource(ROOTS_PATH + "/matches/jcr:content").adaptTo(Node.class); ServiceReference ref = bundleContext.getServiceReference(StructureRewriteRule.class.getName()); StructureRewriteRule rule = bundleContext.<StructureRewriteRule>getService(ref); assertTrue(rule.matches(rootNode)); }
@Test public void testDoesNotMatch() throws Exception { Node rootNode = context.resourceResolver().getResource(ROOTS_PATH + "/doesNotMatch/jcr:content").adaptTo(Node.class); ServiceReference ref = bundleContext.getServiceReference(StructureRewriteRule.class.getName()); StructureRewriteRule rule = bundleContext.<StructureRewriteRule>getService(ref); assertFalse(rule.matches(rootNode)); }