Validate server JSON with org.json as well

This commit is contained in:
Anuken 2023-12-09 12:38:16 -05:00
parent 45c21d60bf
commit cecd84817c
2 changed files with 5 additions and 0 deletions

View file

@ -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);
}