完善 LinksSelector.selectList 的测试用例
parent
ce3f0ac239
commit
5f34adf938
|
@ -1,5 +1,6 @@
|
||||||
package us.codecraft.webmagic.selector;
|
package us.codecraft.webmagic.selector;
|
||||||
|
|
||||||
|
import org.jsoup.Jsoup;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -15,7 +16,12 @@ public class LinksSelectorTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testLinks() throws Exception {
|
public void testLinks() throws Exception {
|
||||||
List<String> links = new LinksSelector().selectList(html);
|
LinksSelector linksSelector = new LinksSelector();
|
||||||
|
List<String> links = linksSelector.selectList(html);
|
||||||
|
System.out.println(links);
|
||||||
|
|
||||||
|
html = "<div><a href='aaa'></a></div><div><a href='http://whatever.com/bbb'></a></div><div><a href='http://other.com/bbb'></a></div>";
|
||||||
|
links = linksSelector.selectList(Jsoup.parse(html, "http://whatever.com/"));
|
||||||
System.out.println(links);
|
System.out.println(links);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue