copy to h3

This commit is contained in:
szznax committed 2009-05-14 23:55:45 +00:00
1 parent 5a4e8c63d3
commit c891a0b278
3 files changed
+24 -2

No files matched your search

@@ -271,6 +271,7 @@ public class ExtractorHTMLTest extends StringExtractorTestBase {
}));
}
/**
* test to see if embedded <SCRIPT/> which writes script TYPE
* creates any outlinks, e.g. "type='text/javascript'".
@@ -296,4 +297,25 @@ public class ExtractorHTMLTest extends StringExtractorTestBase {
assertTrue("outlinks should be empty",curi.getOutLinks().isEmpty());
}
public void testOutLinksWithBaseHref() throws URIException {
DefaultProcessorURI puri = new DefaultProcessorURI(UURIFactory
.getInstance("http://www.example.com/abc/index.html"),null);
puri.setBaseURI(puri.getUURI());
CharSequence cs =
"<base href=\"http://www.example.com/\">" +
"<a href=\"def/another1.html\">" +
"<a href=\"ghi/another2.html\">";
ExtractorHTML extractor = (ExtractorHTML)makeExtractor();
extractor.extract(puri, cs);
Link[] links = puri.getOutLinks().toArray(new Link[0]);
String dest1 = "http://www.example.com/def/another1.html";
String dest2 = "http://www.example.com/ghi/another2.html";
// ensure outlink from base href
assertEquals("outlink1 from base href",dest1,
links[1].getDestination().toString());
assertEquals("outlink2 from base href",dest2,
links[2].getDestination().toString());
}
}