1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package test.wsmo4j.common;
21
22
23
24
25
26
27
28
29
30
31 import org.omwg.ontology.Ontology;
32 import org.wsmo.common.IRI;
33
34 import test.wsmo4j.Wsmo4jTestCase;
35
36 public class TopEntityTest extends Wsmo4jTestCase {
37
38 private Ontology testedOContainer;
39 private IRI myOntologyRef;
40
41 protected void setUp() throws Exception {
42 super.setUp();
43 myOntologyRef = factory.createIRI("http://myOntologyLocation.com/ontology");
44 testedOContainer = factory.createOntology(myOntologyRef);
45 }
46
47 protected void tearDown() throws Exception {
48 super.tearDown();
49 testedOContainer = null;
50 myOntologyRef = null;
51 }
52
53 public void testAddImportedOntology() {
54 if (testedOContainer.listOntologies().contains(testedOContainer)) {
55 testedOContainer.removeOntology(myOntologyRef);
56 assertFalse("Unable to remove an ontology reference!",
57 testedOContainer.listOntologies().contains(testedOContainer));
58 }
59 testedOContainer.addOntology(testedOContainer);
60 assertTrue("Unable to add an ontology reference!",
61 testedOContainer.listOntologies().contains(testedOContainer));
62 }
63
64 public void testRemoveImportedOntology() {
65 if (!testedOContainer.listOntologies().contains(testedOContainer)) {
66 testedOContainer.addOntology(testedOContainer);
67 }
68 testedOContainer.removeOntology(myOntologyRef);
69 assertFalse("Unable to remove an ontology reference!",
70 testedOContainer.listOntologies().contains(testedOContainer));
71 }
72 }
73
74
75
76
77
78
79