update xsoup to 0.3.1

master
yihua.huang 2016-01-20 12:59:11 +08:00
parent 7586e3d75c
commit 5706bb90af
2 changed files with 3 additions and 3 deletions

View File

@ -88,7 +88,7 @@
<dependency> <dependency>
<groupId>us.codecraft</groupId> <groupId>us.codecraft</groupId>
<artifactId>xsoup</artifactId> <artifactId>xsoup</artifactId>
<version>0.2.4</version> <version>0.3.1</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.alibaba</groupId> <groupId>com.alibaba</groupId>

View File

@ -39,11 +39,11 @@ public class HtmlTest {
assertThat(html.links().all()).contains("/xx/xx"); assertThat(html.links().all()).contains("/xx/xx");
} }
@Test(expected = NullPointerException.class) @Test
public void testNthNodesGet(){ public void testNthNodesGet(){
Html html = new Html("<a data-tip=\"p$t$xxx\" href=\"/xx/xx\">xx</a>"); Html html = new Html("<a data-tip=\"p$t$xxx\" href=\"/xx/xx\">xx</a>");
assertThat(html.xpath("//a[1]/@href").get()).isEqualTo("/xx/xx"); assertThat(html.xpath("//a[1]/@href").get()).isEqualTo("/xx/xx");
Selectable selectable = html.xpath("//a[1]").nodes().get(0); Selectable selectable = html.xpath("//a[1]").nodes().get(0);
assertThat(selectable.xpath("@href").get()).isEqualTo("/xx/xx"); assertThat(selectable.xpath("/a/@href").get()).isEqualTo("/xx/xx");
} }
} }