fix test in JsonPathSelectorTest #289
parent
25821c3c06
commit
d8f978fd20
|
@ -1,5 +1,7 @@
|
|||
package us.codecraft.webmagic.selector;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -44,5 +46,10 @@ public class JsonPathSelectorTest {
|
|||
select = jsonPathSelector.select(text);
|
||||
assertThat(select).isEqualTo("Sayings of the Century");
|
||||
assertThat(list).contains("Sayings of the Century");
|
||||
jsonPathSelector = new JsonPathSelector("$.store.book[?(@.category == 'reference')]");
|
||||
select = jsonPathSelector.select(text);
|
||||
JSONObject object1= JSON.parseObject(select);
|
||||
JSONObject object2=JSON.parseObject("{\"author\":\"Nigel Rees\",\"title\":\"Sayings of the Century\",\"category\":\"reference\",\"price\":8.95}");
|
||||
assertThat(object1).isEqualTo(object2);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue