Skip to content

Commit e87cdb5

Browse files
authored
Fixed fetch tests
1 parent 51262d6 commit e87cdb5

File tree

2 files changed

+21
-9
lines changed

2 files changed

+21
-9
lines changed

src/test/java/com/github/underscore/LodashTest.java

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* The MIT License (MIT)
33
*
4-
* Copyright 2015-2025 Valentyn Kolesnikov
4+
* Copyright 2015-2025 Valentyn Kolesnikov <0009-0003-9608-3364@orcid.org>
55
*
66
* Permission is hereby granted, free of charge, to any person obtaining a copy
77
* of this software and associated documentation files (the "Software"), to deal
@@ -594,7 +594,8 @@ void selectTokensGetAllWriters() {
594594
void fetchGet() {
595595
U.FetchResponse result =
596596
U.fetch(
597-
"https://support.oneskyapp.com/hc/en-us/article_attachments/202761627/example_1.json");
597+
"https://raw.githubusercontent.com/javadev/underscore-java/refs/heads/"
598+
+ "main/src/test/resources/example.json");
598599
result.json();
599600
result.jsonMap();
600601
assertEquals(
@@ -607,7 +608,8 @@ void fetchGet() {
607608
assertEquals("Apple", U.get((Map<String, Object>) result.json(), "fruit"));
608609
U.Chain<?> resultChain =
609610
U.chain(
610-
"https://support.oneskyapp.com/hc/en-us/article_attachments/202761627/example_1.json")
611+
"https://raw.githubusercontent.com/javadev/underscore-java/refs/heads/"
612+
+ "main/src/test/resources/example.json")
611613
.fetch();
612614
assertEquals(
613615
"{\n"
@@ -626,7 +628,8 @@ void downloadUrl() throws IOException, URISyntaxException {
626628
try {
627629
long result =
628630
U.downloadUrl(
629-
"https://support.oneskyapp.com/hc/en-us/article_attachments/202761627/example_1.json",
631+
"https://raw.githubusercontent.com/javadev/underscore-java/refs/heads/"
632+
+ "main/src/test/resources/example.json",
630633
"test.json");
631634
assertEquals(65, result);
632635
} catch (javax.net.ssl.SSLHandshakeException ignored) {
@@ -646,7 +649,8 @@ void decompressGzip() throws IOException {
646649
void fetchGetWithTimeouts() {
647650
U.FetchResponse result =
648651
U.fetch(
649-
"https://support.oneskyapp.com/hc/en-us/article_attachments/202761627/example_1.json",
652+
"https://raw.githubusercontent.com/javadev/underscore-java/refs/heads/"
653+
+ "main/src/test/resources/example.json",
650654
30000,
651655
30000);
652656
assertEquals(
@@ -691,7 +695,8 @@ void fetchResponseBlob() {
691695
void fetchGetHttps() {
692696
U.FetchResponse result =
693697
U.fetch(
694-
"https://support.oneskyapp.com/hc/en-us/article_attachments/202761627/example_1.json");
698+
"https://raw.githubusercontent.com/javadev/underscore-java/refs/heads/"
699+
+ "main/src/test/resources/example.json");
695700
assertEquals(
696701
"{\n"
697702
+ " \"fruit\": \"Apple\",\n"
@@ -705,7 +710,8 @@ void fetchGetHttps() {
705710
void fetchPut() {
706711
U.FetchResponse result =
707712
U.fetch(
708-
"https://support.oneskyapp.com/hc/en-us/article_attachments/202761627/example_1.json",
713+
"https://raw.githubusercontent.com/javadev/underscore-java/refs/heads/"
714+
+ "main/src/test/resources/example.json",
709715
"PUT",
710716
"{"
711717
+ " \"dragon\": {"
@@ -718,7 +724,8 @@ void fetchPut() {
718724
assertEquals(403, result.getStatus());
719725
U.FetchResponse result2 =
720726
U.fetch(
721-
"https://support.oneskyapp.com/hc/en-us/article_attachments/202761627/example_1.json",
727+
"https://raw.githubusercontent.com/javadev/underscore-java/refs/heads/"
728+
+ "main/src/test/resources/example.json",
722729
"PUT",
723730
"{"
724731
+ " \"dragon\": {"
@@ -750,7 +757,7 @@ void fetchPut() {
750757
+ "<head><title>301 Moved Permanently</title></head>\n"
751758
+ "<body>\n"
752759
+ "<center><h1>301 Moved Permanently</h1></center>\n"
753-
+ "<hr><center>cloudflare</center>\n"
760+
+ "<hr><center>nginx</center>\n"
754761
+ "</body>\n"
755762
+ "</html>\n",
756763
resultChain.item().replace("\r\n", "\n"));

src/test/resources/example.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"fruit": "Apple",
3+
"size": "Large",
4+
"color": "Red"
5+
}

0 commit comments

Comments
 (0)