MCPcopy Create free account
hub / github.com/GateNLP/gate-core / setUp

Method setUp

src/test/java/gate/annotation/TestAnnotation.java:49–94  ·  view source on GitHub ↗

Fixture set up

()

Source from the content-addressed store, hash-verified

47
48 /** Fixture set up */
49 @Override
50 public void setUp() throws Exception
51 {
52 if (Gate.getGateHome() == null)
53 Gate.init();
54 FeatureMap params = Factory.newFeatureMap();
55 params.put(Document.DOCUMENT_URL_PARAMETER_NAME, new URL(TestDocument.getTestServerName()+"tests/doc0.html"));
56 params.put(Document.DOCUMENT_MARKUP_AWARE_PARAMETER_NAME, "false");
57 doc1 = (Document)Factory.createResource("gate.corpora.DocumentImpl",
58 params);
59
60 emptyFeatureMap = new SimpleFeatureMapImpl();
61
62 basicAS = new AnnotationSetImpl(doc1);
63 FeatureMap fm = new SimpleFeatureMapImpl();
64
65 basicAS.get("T"); // to trigger type indexing
66 basicAS.get(new Long(0)); // trigger offset index (though add will too)
67
68 basicAS.add(new Long(10), new Long(20), "T1", fm); // 0
69 basicAS.add(new Long(10), new Long(20), "T2", fm); // 1
70 basicAS.add(new Long(10), new Long(20), "T3", fm); // 2
71 basicAS.add(new Long(10), new Long(20), "T1", fm); // 3
72
73 fm = new SimpleFeatureMapImpl();
74 fm.put("pos", "NN");
75 fm.put("author", "hamish");
76 fm.put("version", new Integer(1));
77
78 basicAS.add(new Long(10), new Long(20), "T1", fm); // 4
79 basicAS.add(new Long(15), new Long(40), "T1", fm); // 5
80 basicAS.add(new Long(15), new Long(40), "T3", fm); // 6
81 basicAS.add(new Long(15), new Long(40), "T1", fm); // 7
82
83 fm = new SimpleFeatureMapImpl();
84 fm.put("pos", "JJ");
85 fm.put("author", "the devil himself");
86 fm.put("version", new Long(44));
87 fm.put("created", "monday");
88
89 basicAS.add(new Long(15), new Long(40), "T3", fm); // 8
90 basicAS.add(new Long(15), new Long(40), "T1", fm); // 9
91 basicAS.add(new Long(15), new Long(40), "T1", fm); // 10
92
93 // Out.println(basicAS);
94 } // setUp
95
96
97 /** Test indexing by offset */

Callers 1

mainMethod · 0.95

Calls 9

getGateHomeMethod · 0.95
initMethod · 0.95
newFeatureMapMethod · 0.95
getTestServerNameMethod · 0.95
createResourceMethod · 0.95
putMethod · 0.95
getMethod · 0.65
addMethod · 0.65
putMethod · 0.45

Tested by

no test coverage detected