public void testVersionedIDComparisons() {
IRI iri1 = IRI(TEST_ONTOLOGY_IRI_STRING);
IRI iri2 = IRI(TEST_ONTOLOGY_IRI_STRING);
assertEquals(iri1.hashCode(), iri2.hashCode());
assertEquals(iri1, iri2);
OWLOntologyID unversionedID = new OWLOntologyID(of(iri1), absent());
String version1IRIString = TEST_ONTOLOGY_IRI_STRING + "/version1";
IRI version1IRI = IRI(version1IRIString);
OWLOntologyID version1ID = new OWLOntologyID(of(iri2), of(version1IRI));
assertEquals("null vs v1 base IRIs", unversionedID.getOntologyIRI(),
version1ID.getOntologyIRI());
assertNotEquals(unversionedID.getVersionIRI(),
version1ID.getVersionIRI());
assertNotEquals("null version vs version1", unversionedID.hashCode(),
version1ID.hashCode());
assertNotEquals("null version vs version1", unversionedID, version1ID);
OWLOntologyID duplicateVersion1ID = new OWLOntologyID(
of(IRI(TEST_ONTOLOGY_IRI_STRING)), of(IRI(version1IRIString)));
assertEquals(" two version1 ids", version1ID, duplicateVersion1ID);
OWLOntologyID differentBasedVersion1ID = new OWLOntologyID(
of(IRI(TEST_ONTOLOGY_IRI_STRING + "-of-doom")),
of(IRI(version1IRIString)));
assertNotEquals("version1 of two base IRIs", version1ID,
differentBasedVersion1ID);
IRI version2IRI = IRI(TEST_ONTOLOGY_IRI_STRING + "/version2");
IRI iri3 = IRI(TEST_ONTOLOGY_IRI_STRING);
OWLOntologyID version2ID = new OWLOntologyID(of(iri3), of(version2IRI));
assertNotEquals("version1 vs version2", version1ID.hashCode(),
version2ID.hashCode());
assertNotEquals("version1 vs version2", version1ID, version2ID);
}