@Test public void throws_exception_if_reference_is_not_an_attribute() { Search barSearch = new Search(); SDDocumentType barDocument = new SDDocumentType("bar", barSearch); barSearch.addDocument(barDocument); SDField fooRefToBarField = new SDField ("bar_ref", ReferenceDataType.createWithInferredId(barDocument.getDocumentType())); Search fooSearch = new Search(); SDDocumentType fooDocument = new SDDocumentType("foo", fooSearch); fooDocument.addField(fooRefToBarField); fooSearch.addDocument(fooDocument); DocumentReferenceResolver resolver = new DocumentReferenceResolver(asList(fooSearch, barSearch)); exceptionRule.expect(IllegalArgumentException.class); exceptionRule.expectMessage( "The field 'bar_ref' is an invalid document reference. The field must be an attribute."); 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);  }