From b090dcd20d200b51c1627636ba6a1155cddbdf1f Mon Sep 17 00:00:00 2001 From: "yihua.huang" Date: Sun, 18 Dec 2016 07:14:34 +0800 Subject: [PATCH] sepcific error page for HttpClientDownloaderTest to avoid test error when local port is available --- .../webmagic/downloader/HttpClientDownloaderTest.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/webmagic-core/src/test/java/us/codecraft/webmagic/downloader/HttpClientDownloaderTest.java b/webmagic-core/src/test/java/us/codecraft/webmagic/downloader/HttpClientDownloaderTest.java index 63797971..16335375 100644 --- a/webmagic-core/src/test/java/us/codecraft/webmagic/downloader/HttpClientDownloaderTest.java +++ b/webmagic-core/src/test/java/us/codecraft/webmagic/downloader/HttpClientDownloaderTest.java @@ -26,6 +26,8 @@ import static org.junit.Assert.assertTrue; */ public class HttpClientDownloaderTest { + public static final String PAGE_ALWAYS_NOT_EXISTS = "http://localhost:13421/404"; + @Ignore @Test public void testCookie() { @@ -52,7 +54,7 @@ public class HttpClientDownloaderTest { public void testCycleTriedTimes() { HttpClientDownloader httpClientDownloader = new HttpClientDownloader(); Task task = Site.me().setDomain("localhost").setCycleRetryTimes(5).toTask(); - Request request = new Request("http://localhost/404"); + Request request = new Request(PAGE_ALWAYS_NOT_EXISTS); Page page = httpClientDownloader.download(request, task); assertThat(page.getTargetRequests().size() > 0); assertThat((Integer) page.getTargetRequests().get(0).getExtra(Request.CYCLE_TRIED_TIMES)).isEqualTo(1);