@Test
public void testNodeToRootSimple() throws Exception {

    TestUtil.withInMemoryRepo(session -> {
        final NamespaceMapping mapping = new NamespaceMapping(new SessionNamespaceResolver(session));
        TestUtil.installCndFromURL(session, getClass().getResource("/sling_nodetypes.cnd"));
        ChecklistExporter exporter = new ChecklistExporter.Builder().build();
        Node node1 = JcrUtils.getOrCreateByPath("/test/node1", "nt:folder", "sling:Folder", session, true);
        ForcedRoot root1 = exporter.nodeToRoot(node1, mapping).orElse(null);
        assertNotNull("root1 should be present", root1);
        assertEquals("root1 primary type should be sling:Folder", "sling:Folder", root1.getPrimaryType());
        assertTrue("root1 mixin types should be empty", root1.getMixinTypes().isEmpty());
        Node node2 = JcrUtils.getOrCreateByPath("/test/node2", "nt:folder", "sling:OrderedFolder", session, true);
        node2.addMixin(String.format("{%s}title", NamespaceHelper.MIX));
        ForcedRoot root2 = exporter.nodeToRoot(node2, mapping).orElse(null);
        assertNotNull("root2 should be present", root2);
        assertEquals("root2 primary type should be sling:OrderedFolder", "sling:OrderedFolder", root2.getPrimaryType());
        assertTrue("root2 mixin types should contain mix:title", root2.getMixinTypes().contains("mix:title"));
    });
}