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

Method verifyIDConsistency

src/test/java/gate/xml/TestXml.java:376–398  ·  view source on GitHub ↗

Verifies if the two maps hold annotations with the same ID. The only thing not checked are the features, as some of them could be lost in the serialization/deserialization process @param origAnnotMap A map by ID, containing the original annotations @param reloadedAnnMap A map by ID, containing the r

(Map<Integer,Annotation> origAnnotMap, Map<Integer,Annotation> reloadedAnnMap)

Source from the content-addressed store, hash-verified

374 * @param reloadedAnnMap A map by ID, containing the recreated annotations
375 */
376 private void verifyIDConsistency(Map<Integer,Annotation> origAnnotMap, Map<Integer,Annotation> reloadedAnnMap) {
377 assertEquals("Found a different number of annot in both documents.",
378 origAnnotMap.keySet().size(), reloadedAnnMap.keySet().size());
379
380// List orig = new ArrayList(origAnnotMap.keySet());
381// Collections.sort(orig);
382// System.out.println("ORIG SET =" + orig);
383//
384// List rel = new ArrayList(reloadedAnnMap.keySet());
385// Collections.sort(rel);
386// System.out.println("REL SET =" + rel);
387//
388
389 for (Iterator<Integer> it = origAnnotMap.keySet().iterator(); it.hasNext();){
390 Integer id = it.next();
391 Annotation origAnn = origAnnotMap.get(id);
392 Annotation reloadedAnnot = reloadedAnnMap.get(id);
393
394 assertTrue("Annotation with ID="+ id +" was not found in the reloaded document.", reloadedAnnot != null);
395 compareAnnot(origAnn, reloadedAnnot);
396
397 }// End for
398 }// End of verifyIDConsistency()
399
400 /**
401 * Thes if two annotatiosn are the same, except their features.

Calls 7

compareAnnotMethod · 0.95
sizeMethod · 0.65
iteratorMethod · 0.65
hasNextMethod · 0.65
nextMethod · 0.65
getMethod · 0.65
keySetMethod · 0.45

Tested by

no test coverage detected