Skip to content

Commit

Permalink
- B Set DownloadScripts timer to three seconds
Browse files Browse the repository at this point in the history
  • Loading branch information
ScottBob committed Feb 6, 2025
1 parent 21e6623 commit d2e20be
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.time.Duration;
import java.util.Properties;

import org.junit.jupiter.api.Disabled;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;

public class NetUtilsTest
{
Expand Down Expand Up @@ -85,4 +88,9 @@ void testWebPageFromGitHub()
String file = "resources/approve_all" + ".bat";
Approvals.verify(NetUtils.loadWebPage(github + file, null));
}
@Test
void testTimeout() {
assertThrows(Error.class, () ->
NetUtils.loadWebPage("https://httpbin.org/delay/5", null, Duration.ofMillis(50)));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.spun.util.io.NetUtils;

import java.io.File;
import java.time.Duration;

public class LoggingUtils
{
Expand All @@ -19,7 +20,7 @@ public static void downloadScriptIfMissing(String scriptName)
{
String github = "https://raw.githubusercontent.com/approvals/ApprovalTests.Java/refs/heads/master/";
String file = "resources/" + scriptName + extension;
FileUtils.writeFile(script, NetUtils.loadWebPage(github + file, null));
FileUtils.writeFile(script, NetUtils.loadWebPage(github + file, null, Duration.ofSeconds(3)));
script.setExecutable(true);
}
}
Expand Down

0 comments on commit d2e20be

Please sign in to comment.