1
15
16 package gate.creole.gazetteer;
17
18 import java.net.URL;
19
20 import junit.framework.*;
21
22 import gate.*;
23 import gate.corpora.TestDocument;
24
25 public class TestGazetteer extends TestCase {
26
27 public TestGazetteer(String name) {
28 super(name);
29 }
30
31
32 public void setUp() throws Exception {
33 }
34
35 public void tearDown() throws Exception {
36 }
38
39 public void testDefaultGazetteer() throws Exception {
40 Document doc = Factory.newDocument(
42 new URL(TestDocument.getTestServerName() + "tests/doc0.html")
43 );
44
45 DefaultGazetteer gaz = (DefaultGazetteer) Factory.createResource(
47 "gate.creole.gazetteer.DefaultGazetteer");
48
49 gaz.setDocument(doc);
51 gaz.setAnnotationSetName("GazetteerAS");
52 gaz.execute();
53 assertTrue(!doc.getAnnotations("GazetteerAS").isEmpty());
54 }
55
56
57 public static Test suite() {
58 return new TestSuite(TestGazetteer.class);
59 }
61 public static void main(String[] args) {
62 try{
63 Gate.init();
64 TestGazetteer testGaz = new TestGazetteer("");
65 testGaz.setUp();
66 testGaz.testDefaultGazetteer();
67 testGaz.tearDown();
68 } catch(Exception e) {
69 e.printStackTrace();
70 }
71 }
73 }