### Question:
OntologyDataBuilder { public OntologyData build() throws OntologyHelperException { OntologyData ret = null; if (helper.isIriInOntology(iri)) { Collection<String> labels = helper.findLabels(iri); Collection<String> synonyms = includeSynonyms ? helper.findSynonyms(iri) : null; Collection<String> definitions = includeDefinitions ? helper.findDefinitions(iri) : null; Collection<String> childIris = helper.getChildIris(iri); Collection<String> childLabels = helper.findLabelsForIRIs(childIris); Collection<String> parentIris = helper.getParentIris(iri); Collection<String> parentLabels = helper.findLabelsForIRIs(parentIris); Collection<String> descendantIris = includeIndirect ? helper.getDescendantIris(iri) : null; Collection<String> descendantLabels = includeIndirect ? helper.findLabelsForIRIs(descendantIris) : null; Collection<String> ancestorIris = includeIndirect ? helper.getAncestorIris(iri) : null; Collection<String> ancestorLabels = includeIndirect ? helper.findLabelsForIRIs(ancestorIris) : null; Map<String, Collection<String>> relationIris = includeRelations ? helper.getRelations(iri) : null; Map<String, Collection<String>> relationLabels; if (includeRelations) { relationLabels = new HashMap<>(); relationIris.forEach((k, v) -> { try { relationLabels.put(k, helper.findLabelsForIRIs(v)); } catch (OntologyHelperException e) { LOGGER.error(e.getMessage()); } }); } else { relationLabels = null; } Collection<String> parentPaths; if (includeParentPaths) { parentPaths = helper.getParentPaths(iri, includeParentPathLabels); } else { parentPaths = null; } ret = new OntologyData(labels, synonyms, definitions, childIris, childLabels, parentIris, parentLabels, descendantIris, descendantLabels, ancestorIris, ancestorLabels, relationIris, relationLabels, parentPaths); } helper.updateLastCallTime(); return ret; } OntologyDataBuilder(OntologyHelper helper, String iri); OntologyDataBuilder includeIndirect(boolean inc); OntologyDataBuilder includeRelations(boolean inc); OntologyDataBuilder includeSynonyms(boolean inc); OntologyDataBuilder includeDefinitions(boolean inc); OntologyDataBuilder includeParentPaths(boolean inc); OntologyDataBuilder includeParentPathLabels(boolean inc); OntologyData build();  }### Answer:
@Test public void build_withMissingIri() throws Exception { final String iri = "http: OntologyData data = new OntologyDataBuilder(helper, iri).build(); assertNull(data); }
@Test public void build_simple() throws Exception { final String iri = OWLOntologyHelperMethodsTest.TEST_IRI; OntologyData data = new OntologyDataBuilder(helper, iri).build(); assertNotNull(data); assertNotNull(data.getLabels()); assertNull(data.getSynonyms()); assertNull(data.getDefinitions()); assertNull(data.getAncestorIris()); assertNull(data.getAncestorLabels()); assertNull(data.getDescendantIris()); assertNull(data.getDescendantLabels()); assertNull(data.getRelationIris()); assertNull(data.getRelationLabels()); }
@Test public void build_iriNotInOntology() throws Exception { final String iri = OWLOntologyHelperMethodsTest.TEST_IRI; OntologyHelper helper = mock(OntologyHelper.class); when(helper.isIriInOntology(iri)).thenReturn(false); OntologyData data = new OntologyDataBuilder(helper, iri).build(); assertNull(data); verify(helper).isIriInOntology(iri); }