@Test
public void testNodeToRootPathScoped() throws Exception {

    TestUtil.withInMemoryRepo(session -> {
        final NamespaceMapping mapping = new NamespaceMapping(new SessionNamespaceResolver(session));
        TestUtil.installCndFromURL(session, getClass().getResource("/sling_nodetypes.cnd"));
        Node node1 = JcrUtils.getOrCreateByPath("/test_include/node1", "nt:folder", session);
        Node node2 = JcrUtils.getOrCreateByPath("/test_exclude/node2", "nt:folder", session);
        ChecklistExporter exporter = new ChecklistExporter.Builder()
                .withScopePaths(Rules
                        .fromJsonArray(arr(key("type", "include").key("pattern", "/test_include(/.*)?"))
                                .get())).build();
        ForcedRoot root1 = exporter.nodeToRoot(node1, mapping).orElse(null);
        assertNotNull("root1 should not be null", root1);
        ForcedRoot root2 = exporter.nodeToRoot(node2, mapping).orElse(null);
        assertNull("root2 should be null", root2);
    });
}