浏览代码

Add empty config test

Lortseam 4 年之前
父节点
当前提交
94d64b3ad9
共有 1 个文件被更改,包括 7 次插入0 次删除
  1. 7 0
      lib/src/test/java/me/lortseam/completeconfig/data/ConfigTest.java

+ 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());
+    }
+
 }