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