Commit fb0acd71 authored by yihua.huang's avatar yihua.huang

complete SimpleHttpClientTest

parent d07941d9
package us.codecraft.webmagic; package us.codecraft.webmagic;
import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import us.codecraft.webmagic.model.AfterExtractor; import us.codecraft.webmagic.model.AfterExtractor;
import us.codecraft.webmagic.model.annotation.ExtractBy; import us.codecraft.webmagic.model.annotation.ExtractBy;
import static org.assertj.core.api.Assertions.assertThat;
/** /**
* @author code4crafter@gmail.com * @author code4crafter@gmail.com
* Date: 2017/6/3 * Date: 2017/6/3
...@@ -76,12 +79,13 @@ public class SimpleHttpClientTest { ...@@ -76,12 +79,13 @@ public class SimpleHttpClientTest {
} }
} }
@Ignore
@Test @Test
public void test() throws Exception { public void test() throws Exception {
SimpleHttpClient simpleClient = new SimpleHttpClient(Site.me().setUserAgent( SimpleHttpClient simpleClient = new SimpleHttpClient(Site.me().setUserAgent(
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.115 Safari/537.36")); "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.115 Safari/537.36"));
Weather weather = simpleClient.get("http://www.weather.com.cn/weather/101020100.shtml", Weather.class); Weather weather = simpleClient.get("http://www.weather.com.cn/weather/101020100.shtml", Weather.class);
System.out.println(weather); assertThat(weather).isNotNull();
} }
} }
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