public void resolveReferences(SDDocumentType documentType) {
        var references = new DocumentReferences(createFieldToDocumentReferenceMapping(documentType));
        documentType.setDocumentReferences(references);
    }
@Test
    void throws_user_friendly_exception_if_referenced_document_does_not_exist() {
        Throwable exception = assertThrows(IllegalArgumentException.class, () -> {
            // Create foo document with document reference to non-existing document bar
            Schema fooSchema = new Schema(FOO, MockApplicationPackage.createEmpty());
            SDDocumentType fooDocument = new SDDocumentType("foo", fooSchema);
            SDField fooRefToBarField = new SDField(
                    fooDocument,
                    "bar_ref", NewDocumentReferenceDataType.forDocumentName("bar"));
            AttributeUtils.addAttributeAspect(fooSchema.getName(), fooRefToBarField);
            fooDocument.addField(fooRefToBarField);
            fooSchema.addDocument(fooDocument);

            DocumentReferenceResolver resolver = new DocumentReferenceResolver(List.of(fooSchema));
            resolver.resolveReferences(fooDocument);
        });
        assertTrue(exception.getMessage().contains("Invalid document reference 'bar_ref': Could not find document type 'bar'"));
    }