TypesHandler { void addTypes(NamedResource subject, URI context, Set<URI> types) { assert !types.isEmpty(); final List<OWLAxiom> axioms = getOwlAxiomsForTypes(subject, types); final List<OWLOntologyChange> changes = axioms.stream().map(axiom -> new MutableAddAxiom(ontology, axiom)) .collect(Collectors.toList()); adapter.addTransactionalChanges(snapshot.applyChanges(changes)); } TypesHandler(OwlapiAdapter adapter, OntologySnapshot snapshot);   }
@Test void addTypesAddsClassAssertionAxiomsForTheTypes() { final Set<URI> typeUris = initTypes(); typesHandler.addTypes(INDIVIDUAL, null, typeUris); final ArgumentCaptor<List> captor = ArgumentCaptor.forClass(List.class); verify(managerMock).applyChanges(captor.capture()); final List<?> addChanges = captor.getValue(); assertEquals(typeUris.size(), addChanges.size()); for (Object change : addChanges) { assertTrue(change instanceof MutableAddAxiom); final MutableAddAxiom ax = (MutableAddAxiom) change; final OWLClassAssertionAxiom clsAxiom = (OWLClassAssertionAxiom) ax.getAxiom(); assertTrue(typeUris.contains(clsAxiom.getClassExpression().asOWLClass().getIRI().toURI())); } verify(adapterMock).addTransactionalChanges(anyList()); }