private PDStructureTreeRoot getStructureTreeRoot()
    {
        PDStructureNode parent = this.getParent();
        while (parent instanceof PDStructureElement)
        {
            parent = ((PDStructureElement) parent).getParent();
        }
        if (parent instanceof PDStructureTreeRoot)
        {
            return (PDStructureTreeRoot) parent;
        }
        return null;
    }
@Test
    void testClassMap() throws IOException
    {
        Set<Revisions<PDAttributeObject>> attributeSet = new HashSet<>();
        Set<String> classSet = new HashSet<>();
        try (PDDocument doc = Loader.loadPDF(
                RandomAccessReadBuffer.createBufferFromStream(PDStructureElementTest.class
                        .getResourceAsStream("PDFBOX-2725-878725.pdf"))))
        {
            PDStructureTreeRoot structureTreeRoot = doc.getDocumentCatalog().getStructureTreeRoot();
            checkElement(structureTreeRoot.getK(), attributeSet, structureTreeRoot.getClassMap(), classSet);
        }

        // collect attributes and check their count.
        assertEquals(72, attributeSet.size());
        int cnt = attributeSet.stream().map(attributes -> attributes.size()).reduce(0, Integer::sum);
        assertEquals(45, cnt);
        assertEquals(10, classSet.size());
    }