From b9a8304c660afc09ca9d499aeeeb33085a73f2c8 Mon Sep 17 00:00:00 2001 From: gudaoxuri Date: Thu, 1 Jun 2017 20:41:33 +0800 Subject: [PATCH] Fix test error on travis-ci.org #Build #17 --- src/test/java/com/ecfront/dew/common/HttpHelperTest.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/test/java/com/ecfront/dew/common/HttpHelperTest.java b/src/test/java/com/ecfront/dew/common/HttpHelperTest.java index ebb36f5..50bf31a 100644 --- a/src/test/java/com/ecfront/dew/common/HttpHelperTest.java +++ b/src/test/java/com/ecfront/dew/common/HttpHelperTest.java @@ -40,8 +40,7 @@ public void testHttp() throws Exception { Assert.assertEquals("1", $.json.toJson(result).get("form").get("a").asText()); // post - file result = $.http.post("https://httpbin.org/post", new File(this.getClass().getResource("/").getPath() + "conf1.json")); - System.out.println(result); - Assert.assertEquals("{\r\n \"a\":1\r\n}", $.json.toJson(result).get("files").get("conf1.json").asText()); + Assert.assertEquals("1", $.json.toJson($.json.toJson(result).get("files").get("conf1.json").asText()).get("a").asText()); // put - data result = $.http.put("https://httpbin.org/put", "some data"); Assert.assertEquals("some data", $.json.toJson(result).get("data").asText()); @@ -52,10 +51,10 @@ public void testHttp() throws Exception { Assert.assertEquals("1", $.json.toJson(result).get("form").get("a").asText()); // put - file result = $.http.put("https://httpbin.org/put", new File(this.getClass().getResource("/").getPath() + "conf1.json")); - Assert.assertEquals("{\r\n \"a\":1\r\n}", $.json.toJson(result).get("files").get("conf1.json").asText()); + Assert.assertEquals("1", $.json.toJson($.json.toJson(result).get("files").get("conf1.json").asText()).get("a").asText()); // put with head HttpHelper.WrapHead wrapHead = $.http.putWithHead("https://httpbin.org/put", new File(this.getClass().getResource("/").getPath() + "conf1.json")); - Assert.assertEquals("{\r\n \"a\":1\r\n}", $.json.toJson(wrapHead.result).get("files").get("conf1.json").asText()); + Assert.assertEquals("1", $.json.toJson($.json.toJson(result).get("files").get("conf1.json").asText()).get("a").asText()); Assert.assertEquals("application/json", wrapHead.head.get("Content-Type")); // head Map head = $.http.head("https://httpbin.org/get");