Răsfoiți Sursa

Add empty config test

Lortseam 4 ani în urmă
părinte
comite
94d64b3ad9

+ 7 - 0
lib/src/test/java/me/lortseam/completeconfig/data/ConfigTest.java

@@ -1,5 +1,6 @@
 package me.lortseam.completeconfig.data;
 
+import me.lortseam.completeconfig.api.ConfigContainer;
 import nl.altindag.log.LogCaptor;
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.Test;
@@ -27,4 +28,10 @@ public class ConfigTest {
         assertThrows(NullPointerException.class, () -> new Config(MOD_ID, new String[]{null}));
     }
 
+    @Test
+    public void _throwExceptionIfContainersEmpty() {
+        IllegalArgumentException exception = assertThrows(IllegalArgumentException.class, () -> new Config(MOD_ID, new ConfigContainer[] {new ConfigContainer() {}}));
+        assertEquals("Config of ConfigSource(modId=" + MOD_ID + ", branch=[]) is empty", exception.getMessage());
+    }
+
 }