public Set<NewDocumentType> build(ModelElement documentsElement) {
        if (documentsElement == null || documentsElement.subElements("document").isEmpty())
            return Set.of();

        return documentsElement.subElements("document")
                .stream()
                .filter(GlobalDistributionBuilder::isGloballyDistributed)
                .map(GlobalDistributionBuilder::getDocumentName)
                .map(this::getDocumentType)
                .collect(Collectors.toCollection(LinkedHashSet::new));
    }
@Test
    void global_documents_are_identified() {
        GlobalDistributionBuilder builder = new GlobalDistributionBuilder(createDocumentDefinitions());
        String documentsElement =
                "<documents>" +
                        "  <document type=\"" + NON_GLOBAL_EXPLICIT.getName() + "\" global=\"false\"/>" +
                        "  <document type=\"" + GLOBAL_1.getName() + "\" global=\"true\"/>" +
                        "  <document type=\"" + NON_GLOBAL_IMPLICIT.getName() + "\"/>" +
                        "  <document type=\"" + GLOBAL_2.getName() + "\" global=\"true\"/>" +
                        "</documents>";

        Set<NewDocumentType> expectedResult = Set.of(GLOBAL_1, GLOBAL_2);
        Set<NewDocumentType> actualResult = builder.build(new ModelElement(XML.getDocument(documentsElement).getDocumentElement()));
        assertEquals(expectedResult, actualResult);
    }