From 4dea075306a9567940b7514cf2e708f0aefccec8 Mon Sep 17 00:00:00 2001 From: Valentyn Kolesnikov Date: Mon, 25 Aug 2025 10:04:11 +0300 Subject: [PATCH 1/3] Fixed fetch tests --- .../com/github/underscore/LodashTest.java | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/test/java/com/github/underscore/LodashTest.java b/src/test/java/com/github/underscore/LodashTest.java index 69cc2e09..46921b78 100644 --- a/src/test/java/com/github/underscore/LodashTest.java +++ b/src/test/java/com/github/underscore/LodashTest.java @@ -594,7 +594,8 @@ void selectTokensGetAllWriters() { void fetchGet() { U.FetchResponse result = U.fetch( - "https://support.oneskyapp.com/hc/en-us/article_attachments/202761627/example_1.json"); + "https://raw.githubusercontent.com/javadev/underscore-java/refs/heads/" + + "main/src/test/resources/example.json"); result.json(); result.jsonMap(); assertEquals( @@ -607,7 +608,8 @@ void fetchGet() { assertEquals("Apple", U.get((Map) result.json(), "fruit")); U.Chain resultChain = U.chain( - "https://support.oneskyapp.com/hc/en-us/article_attachments/202761627/example_1.json") + "https://raw.githubusercontent.com/javadev/underscore-java/refs/heads/" + + "main/src/test/resources/example.json") .fetch(); assertEquals( "{\n" @@ -626,7 +628,8 @@ void downloadUrl() throws IOException, URISyntaxException { try { long result = U.downloadUrl( - "https://support.oneskyapp.com/hc/en-us/article_attachments/202761627/example_1.json", + "https://raw.githubusercontent.com/javadev/underscore-java/refs/heads/" + + "main/src/test/resources/example.json", "test.json"); assertEquals(65, result); } catch (javax.net.ssl.SSLHandshakeException ignored) { @@ -646,7 +649,8 @@ void decompressGzip() throws IOException { void fetchGetWithTimeouts() { U.FetchResponse result = U.fetch( - "https://support.oneskyapp.com/hc/en-us/article_attachments/202761627/example_1.json", + "https://raw.githubusercontent.com/javadev/underscore-java/refs/heads/" + + "main/src/test/resources/example.json", 30000, 30000); assertEquals( @@ -706,7 +710,8 @@ void fetchGetHttps() { void fetchPut() { U.FetchResponse result = U.fetch( - "https://support.oneskyapp.com/hc/en-us/article_attachments/202761627/example_1.json", + "https://raw.githubusercontent.com/javadev/underscore-java/refs/heads/" + + "main/src/test/resources/example.json", "PUT", "{" + " \"dragon\": {" @@ -719,7 +724,8 @@ void fetchPut() { assertEquals(403, result.getStatus()); U.FetchResponse result2 = U.fetch( - "https://support.oneskyapp.com/hc/en-us/article_attachments/202761627/example_1.json", + "https://raw.githubusercontent.com/javadev/underscore-java/refs/heads/" + + "main/src/test/resources/example.json", "PUT", "{" + " \"dragon\": {" @@ -751,7 +757,7 @@ void fetchPut() { + "301 Moved Permanently\n" + "\n" + "

301 Moved Permanently

\n" - + "
cloudflare
\n" + + "
nginx
\n" + "\n" + "\n", resultChain.item().replace("\r\n", "\n")); From 6779b3b5e2dced939011c58542c075d1114c2a64 Mon Sep 17 00:00:00 2001 From: Valentyn Kolesnikov Date: Mon, 25 Aug 2025 10:07:11 +0300 Subject: [PATCH 2/3] Removed fetch put test --- .../java/com/github/underscore/LodashTest.java | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/src/test/java/com/github/underscore/LodashTest.java b/src/test/java/com/github/underscore/LodashTest.java index 46921b78..80cd99c6 100644 --- a/src/test/java/com/github/underscore/LodashTest.java +++ b/src/test/java/com/github/underscore/LodashTest.java @@ -722,23 +722,6 @@ void fetchPut() { + " }" + "}"); assertEquals(403, result.getStatus()); - U.FetchResponse result2 = - U.fetch( - "https://raw.githubusercontent.com/javadev/underscore-java/refs/heads/" - + "main/src/test/resources/example.json", - "PUT", - "{" - + " \"dragon\": {" - + " \"scaleThickness\": 4," - + " \"clawSharpness\": 2," - + " \"wingStrength\": 4," - + " \"fireBreath\": 10" - + " }" - + "}", - null, - null, - null); - assertEquals(403, result2.getStatus()); U.Chain resultChain = U.chain( "http://support.oneskyapp.com/hc/en-us/article_attachments/202761627/example_1.json") From 4ce5c4995ee117f5f0ba2ee5839a5c4f15d33558 Mon Sep 17 00:00:00 2001 From: Valentyn Kolesnikov Date: Mon, 25 Aug 2025 11:08:57 +0300 Subject: [PATCH 3/3] Restored fetch put test --- .../java/com/github/underscore/LodashTest.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/test/java/com/github/underscore/LodashTest.java b/src/test/java/com/github/underscore/LodashTest.java index 80cd99c6..46921b78 100644 --- a/src/test/java/com/github/underscore/LodashTest.java +++ b/src/test/java/com/github/underscore/LodashTest.java @@ -722,6 +722,23 @@ void fetchPut() { + " }" + "}"); assertEquals(403, result.getStatus()); + U.FetchResponse result2 = + U.fetch( + "https://raw.githubusercontent.com/javadev/underscore-java/refs/heads/" + + "main/src/test/resources/example.json", + "PUT", + "{" + + " \"dragon\": {" + + " \"scaleThickness\": 4," + + " \"clawSharpness\": 2," + + " \"wingStrength\": 4," + + " \"fireBreath\": 10" + + " }" + + "}", + null, + null, + null); + assertEquals(403, result2.getStatus()); U.Chain resultChain = U.chain( "http://support.oneskyapp.com/hc/en-us/article_attachments/202761627/example_1.json")