complete SimpleHttpClientTest

pull/202/merge
yihua.huang 8 years ago
parent d07941d900
commit fb0acd710c

@ -1,9 +1,12 @@
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 {
} }
} }
@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();
} }
} }

Loading…
Cancel
Save