diff --git a/build.gradle b/build.gradle index e3ae3ad3e9..1828919509 100644 --- a/build.gradle +++ b/build.gradle @@ -381,6 +381,7 @@ project(":tests"){ testImplementation "org.junit.jupiter:junit-jupiter-params:5.7.1" testImplementation "org.junit.jupiter:junit-jupiter-api:5.7.1" testImplementation arcModule("backends:backend-headless") + testImplementation "org.json:json:20230618" testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.7.1" } diff --git a/tests/src/test/java/ApplicationTests.java b/tests/src/test/java/ApplicationTests.java index 1885a31d94..773a91ffa3 100644 --- a/tests/src/test/java/ApplicationTests.java +++ b/tests/src/test/java/ApplicationTests.java @@ -26,6 +26,7 @@ import mindustry.type.*; import mindustry.world.*; import mindustry.world.blocks.payloads.*; import mindustry.world.blocks.storage.*; +import org.json.*; import org.junit.jupiter.api.*; import org.junit.jupiter.params.*; import org.junit.jupiter.params.provider.*; @@ -227,11 +228,14 @@ public class ApplicationTests{ void serverListJson(){ String[] files = {"servers_v6.json", "servers_v7.json", "servers_be.json"}; + for(String file : files){ try{ String str = Core.files.absolute("./../../" + file).readString(); assertEquals(ValueType.array, new JsonReader().parse(str).type()); assertTrue(Jval.read(str).isArray()); + JSONArray array = new JSONArray(str); + assertTrue(array.length() > 0); }catch(Exception e){ fail("Failed to parse " + file, e); }