1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-01-19 08:52:15 +01:00

Fixed failures in download tests

This commit is contained in:
Cristian Maglie 2020-02-06 15:46:31 +01:00
parent efdd341e0e
commit b59c91ebe2
3 changed files with 7 additions and 1 deletions

View File

@ -8,6 +8,8 @@ import com.fasterxml.jackson.module.mrbean.MrBeanModule;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import processing.app.BaseNoGui;
import processing.app.helpers.FileUtils; import processing.app.helpers.FileUtils;
import java.io.File; import java.io.File;
@ -38,6 +40,7 @@ public class GzippedJsonDownloaderTest {
@Test @Test
public void testJsonDownload() throws Exception { public void testJsonDownload() throws Exception {
BaseNoGui.initPlatform();
new GZippedJsonDownloader(downloader, new URL("http://downloads.arduino.cc/libraries/library_index.json"), new GZippedJsonDownloader(downloader, new URL("http://downloads.arduino.cc/libraries/library_index.json"),
new URL("http://downloads.arduino.cc/libraries/library_index.json.gz")) new URL("http://downloads.arduino.cc/libraries/library_index.json.gz"))
.download(tempFile, new MultiStepProgress(1), "", new NoopProgressListener(), true); .download(tempFile, new MultiStepProgress(1), "", new NoopProgressListener(), true);

View File

@ -8,6 +8,8 @@ import com.fasterxml.jackson.module.mrbean.MrBeanModule;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import processing.app.BaseNoGui;
import processing.app.helpers.FileUtils; import processing.app.helpers.FileUtils;
import java.io.File; import java.io.File;
@ -38,6 +40,7 @@ public class JsonDownloaderTest {
@Test @Test
public void testJsonDownload() throws Exception { public void testJsonDownload() throws Exception {
BaseNoGui.initPlatform();
new JsonDownloader(downloader, new URL("http://downloads.arduino.cc/libraries/library_index.json")) new JsonDownloader(downloader, new URL("http://downloads.arduino.cc/libraries/library_index.json"))
.download(tempFile, new MultiStepProgress(1), "", new NoopProgressListener(), true); .download(tempFile, new MultiStepProgress(1), "", new NoopProgressListener(), true);

View File

@ -509,7 +509,7 @@ public class BaseNoGui {
} }
} }
static protected void initPlatform() { static public void initPlatform() {
try { try {
Class<?> platformClass = Class.forName("processing.app.Platform"); Class<?> platformClass = Class.forName("processing.app.Platform");
if (OSUtils.isMacOS()) { if (OSUtils.isMacOS()) {