Search in sources :

Example 1 with ParseTest

use of org.jsoup.integration.ParseTest in project jsoup by jhy.

the class DocumentTest method testLocation.

@Test
public void testLocation() throws IOException {
    File in = new ParseTest().getFile("/htmltests/yahoo-jp.html");
    Document doc = Jsoup.parse(in, "UTF-8", "http://www.yahoo.co.jp/index.html");
    String location = doc.location();
    String baseUri = doc.baseUri();
    assertEquals("http://www.yahoo.co.jp/index.html", location);
    assertEquals("http://www.yahoo.co.jp/_ylh=X3oDMTB0NWxnaGxsBF9TAzIwNzcyOTYyNjUEdGlkAzEyBHRtcGwDZ2Ex/", baseUri);
    in = new ParseTest().getFile("/htmltests/nyt-article-1.html");
    doc = Jsoup.parse(in, null, "http://www.nytimes.com/2010/07/26/business/global/26bp.html?hp");
    location = doc.location();
    baseUri = doc.baseUri();
    assertEquals("http://www.nytimes.com/2010/07/26/business/global/26bp.html?hp", location);
    assertEquals("http://www.nytimes.com/2010/07/26/business/global/26bp.html?hp", baseUri);
}
Also used : ParseTest(org.jsoup.integration.ParseTest) File(java.io.File) Test(org.junit.Test) ParseTest(org.jsoup.integration.ParseTest)

Aggregations

File (java.io.File)1 ParseTest (org.jsoup.integration.ParseTest)1 Test (org.junit.Test)1