@Test public void throws_user_friendly_exception_if_referenced_document_does_not_exist() { SDField fooRefToBarField = new SDField( "bar_ref", ReferenceDataType.createWithInferredId(TemporaryStructuredDataType.create("bar"))); AttributeUtils.addAttributeAspect(fooRefToBarField); Search fooSearch = new Search(); SDDocumentType fooDocument = new SDDocumentType("foo", fooSearch); fooDocument.addField(fooRefToBarField); fooSearch.addDocument(fooDocument); DocumentReferenceResolver resolver = new DocumentReferenceResolver(singletonList(fooSearch)); exceptionRule.expect(IllegalArgumentException.class); exceptionRule.expectMessage( "Invalid document reference 'bar_ref': Could not find document type 'bar'"); resolver.resolveReferences(fooDocument); }
public void resolveReferences(SDDocumentType documentType) { var references = new DocumentReferences(createFieldToDocumentReferenceMapping(documentType)); documentType.setDocumentReferences(references); }
DocumentReferenceResolver { public void resolveReferences(SDDocumentType documentType) { var references = new DocumentReferences(createFieldToDocumentReferenceMapping(documentType)); documentType.setDocumentReferences(references); } }
DocumentReferenceResolver { public void resolveReferences(SDDocumentType documentType) { var references = new DocumentReferences(createFieldToDocumentReferenceMapping(documentType)); documentType.setDocumentReferences(references); } DocumentReferenceResolver(List<Search> schemas); }
DocumentReferenceResolver { public void resolveReferences(SDDocumentType documentType) { var references = new DocumentReferences(createFieldToDocumentReferenceMapping(documentType)); documentType.setDocumentReferences(references); } DocumentReferenceResolver(List<Search> schemas); void resolveReferences(SDDocumentType documentType); void resolveInheritedReferences(SDDocumentType documentType); }
DocumentReferenceResolver { public void resolveReferences(SDDocumentType documentType) { var references = new DocumentReferences(createFieldToDocumentReferenceMapping(documentType)); documentType.setDocumentReferences(references); } DocumentReferenceResolver(List<Search> schemas); void resolveReferences(SDDocumentType documentType); void resolveInheritedReferences(SDDocumentType documentType);  }