// We need a registry with at least 2 libraries to check that only one will be loaded.
while (it.hasNext() && !reg.hasChildren() || reg.getChildren().length < 2);
assertNotNull(reg);
// There has to be at least one library with 2 children or more from the test registries...
Library lib1 = null, lib2 = null;
RegistryItem[] children = reg.getChildren();
assertTrue(children.length >= 2);
for (int i = 0; i < children.length - 1 && lib1 == null && lib2 == null; i++) {
if (children[i] instanceof Library) lib1 = (Library) (children[i]);
if (children[i + 1] instanceof Library) lib2 = (Library) (children[i + 1]);
}
assertFalse(lib1 == lib2);
assertNotNull(lib1);
// ...but its ontologies must not be loaded yet.
assertFalse(lib1.isLoaded());
assertFalse(lib2.isLoaded());
// Touch the library. Also test that the listener system works.
assertFalse(lib1.getOntologies(OWLOntology.class).isEmpty());
assertTrue(lib1.isLoaded());
assertFalse(lib2.isLoaded());
}