robot-core/src/test/java/org/obolibrary/robot/OntologyHelperTest.java
@Test
  public void testSetOntologyIRI() throws Exception {
    OWLOntology simple = loadOntology("/simple.owl");
    OntologyHelper.setOntologyIRI(simple, "http://ontology.iri", "http://version.iri");

    IRI ontologyIRI = simple.getOntologyID().getOntologyIRI().orNull();
    IRI versionIRI = simple.getOntologyID().getVersionIRI().orNull();
    if (ontologyIRI != null) {
      assertEquals("http://ontology.iri", ontologyIRI.toString());
    } else {
      throw new Exception(String.format("Ontology IRI for %s does not exist.", "/simple.owl"));
    }
    if (versionIRI != null) {
      assertEquals("http://version.iri", versionIRI.toString());
    } else {
      throw new Exception(String.format("Version IRI for %s does not exist.", "/simple.owl"));
    }
  }
/**
   * Test changing an ontology IRI.
   *
   * @throws Exception on any problem
   */
Test changing an ontology IRI.
@throws Exception on any problem
Test changing an ontology IRI . @throws Exception on any problem
@Test
  public void testSetOntologyIRI() throws Exception {
    OWLOntology simple = loadOntology("/simple.owl");
    OntologyHelper.setOntologyIRI(simple, "http://ontology.iri", "http://version.iri");
    IRI ontologyIRI = simple.getOntologyID().getOntologyIRI().orNull();
    IRI versionIRI = simple.getOntologyID().getVersionIRI().orNull();
    if (ontologyIRI != null) {
      assertEquals("http://ontology.iri", ontologyIRI.toString());
    } else {
      throw new Exception(String.format("Ontology IRI for %s does not exist.", "/simple.owl"));
    }
    if (versionIRI != null) {
      assertEquals("http://version.iri", versionIRI.toString());
    } else {
      throw new Exception(String.format("Version IRI for %s does not exist.", "/simple.owl"));
    }
  }
@ Test public void testSetOntologyIRI ( ) throws Exception { OWLOntology simple = loadOntology ( "/simple.owl" ) ; OntologyHelper . setOntologyIRI ( simple , "http://ontology.iri" , "http://version.iri" ) ; IRI ontologyIRI = simple . getOntologyID ( ) . getOntologyIRI ( ) . orNull ( ) ; IRI versionIRI = simple . getOntologyID ( ) . getVersionIRI ( ) . orNull ( ) ; if ( ontologyIRI != null ) { assertEquals ( "http://ontology.iri" , ontologyIRI . toString ( ) ) ; } else { throw new Exception ( String . format ( "Ontology IRI for %s does not exist." , "/simple.owl" ) ) ; } if ( versionIRI != null ) { assertEquals ( "http://version.iri" , versionIRI . toString ( ) ) ; } else { throw new Exception ( String . format ( "Version IRI for %s does not exist." , "/simple.owl" ) ) ; } }
Test changing an ontology IRI.
Test changing an ontology IRI .