public void resolveReferences(SDDocumentType documentType) {
        var references = new DocumentReferences(createFieldToDocumentReferenceMapping(documentType));
        documentType.setDocumentReferences(references);
    }
@Test
    void reference_from_one_document_to_another_is_resolved() {
        // Create bar document with no fields
        Schema barSchema = new Schema(BAR, MockApplicationPackage.createEmpty());
        SDDocumentType barDocument = new SDDocumentType(BAR, barSchema);
        barSchema.addDocument(barDocument);

        // Create foo document with document reference to bar and add another field
        Schema fooSchema = new Schema(FOO, MockApplicationPackage.createEmpty());
        SDDocumentType fooDocument = new SDDocumentType("foo", fooSchema);
        SDField fooRefToBarField = new SDField
                (fooDocument, "bar_ref", new NewDocumentReferenceDataType(barDocument.getDocumentType()));
        AttributeUtils.addAttributeAspect(fooSchema.getName(), fooRefToBarField);
        SDField irrelevantField = new SDField(fooDocument, "irrelevant_stuff", DataType.INT);
        fooDocument.addField(fooRefToBarField);
        fooDocument.addField(irrelevantField);
        fooSchema.addDocument(fooDocument);

        DocumentReferenceResolver resolver = new DocumentReferenceResolver(List.of(fooSchema, barSchema));
        resolver.resolveReferences(fooDocument);
        assertTrue(fooDocument.getDocumentReferences().isPresent());

        Map<String, DocumentReference> fooReferenceMap = fooDocument.getDocumentReferences().get().referenceMap();
        assertEquals(1, fooReferenceMap.size());
        assertSame(barSchema, fooReferenceMap.get("bar_ref").targetSearch());
        assertSame(fooRefToBarField, fooReferenceMap.get("bar_ref").referenceField());
    }