Commit 5f34adf9 authored by GZhY's avatar GZhY

完善 LinksSelector.selectList 的测试用例

parent ce3f0ac2
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 { ...@@ -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);
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment