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

Method testUnpackMarkup

src/test/java/gate/html/TestHtml.java:42–84  ·  view source on GitHub ↗

A test

()

Source from the content-addressed store, hash-verified

40
41 /** A test */
42 public void testUnpackMarkup() throws Exception {
43
44 gate.Document doc = null;
45 /*
46 markupElementsMap = new HashMap();
47 // populate it
48 markupElementsMap.put ("h1","Header 1");
49 markupElementsMap.put ("H1","Header 1");
50 markupElementsMap.put ("A","link");
51 markupElementsMap.put ("a","link");
52 */
53 doc = gate.Factory.newDocument(new URL(TestDocument.getTestServerName()+"tests/html/test1.htm"));
54// doc = gate.Factory.newDocument(new URL("http://www"));
55
56 // get the docFormat that deals with it.
57 gate.DocumentFormat docFormat = gate.DocumentFormat.getDocumentFormat(
58 doc, doc.getSourceUrl()
59 );
60 assertTrue( "Bad document Format was produced. HtmlDocumentFormat was expected",
61 docFormat.getMimeType().equals(new MimeType("text","html"))
62 );
63
64
65 // set's the map
66 // Don't need to unpack markup explicitly, as it is already unpacked by
67 // default by newDocument - unpacking it twice causes exceptions
68 //docFormat.setMarkupElementsMap(markupElementsMap);
69 //docFormat.unpackMarkup (doc,"DocumentContent");
70
71 gate.corpora.TestDocument.verifyNodeIdConsistency(doc);
72/*
73 // Save it as XML
74 File xmlFile = null;
75 xmlFile = Files.writeTempFile(null);
76
77 OutputStreamWriter writer = new OutputStreamWriter(
78 new FileOutputStream(xmlFile),"UTF-8");
79 // Write (test the toXml() method)
80 writer.write(doc.toXml());
81 writer.flush();
82 writer.close();
83*/
84 } // testUnpackMarkup()
85//*
86
87

Callers

nothing calls this directly

Calls 7

getTestServerNameMethod · 0.95
newDocumentMethod · 0.80
getDocumentFormatMethod · 0.80
getSourceUrlMethod · 0.65
equalsMethod · 0.65
getMimeTypeMethod · 0.45

Tested by

no test coverage detected