@Test public void combined_inherit_and_ref_cycle_is_forbidden() { Search search1 = createSearchWithName("doc1"); Search search2 = createSearchWithName("doc2", search1); Search search3 = createSearchWithName("doc3", search2); createDocumentReference(search1, search3, "ref_1"); DocumentGraphValidator validator = new DocumentGraphValidator(); exceptionRule.expect(DocumentGraphValidator.DocumentGraphException.class); exceptionRule.expectMessage("Document dependency cycle detected: doc1->doc3->doc2->doc1."); validator.validateDocumentGraph(documentListOf(search1, search2, search3)); }
public void validateDocumentGraph(List<SDDocumentType> documents) { for (SDDocumentType document : documents) { validateRoot(document); } }
DocumentGraphValidator { public void validateDocumentGraph(List<SDDocumentType> documents) { for (SDDocumentType document : documents) { validateRoot(document); } } }
DocumentGraphValidator { public void validateDocumentGraph(List<SDDocumentType> documents) { for (SDDocumentType document : documents) { validateRoot(document); } }  }
DocumentGraphValidator { public void validateDocumentGraph(List<SDDocumentType> documents) { for (SDDocumentType document : documents) { validateRoot(document); } }  void validateDocumentGraph(List<SDDocumentType> documents); }
DocumentGraphValidator { public void validateDocumentGraph(List<SDDocumentType> documents) { for (SDDocumentType document : documents) { validateRoot(document); } }  void validateDocumentGraph(List<SDDocumentType> documents);  }