ConfigTest.java 823 B

123456789101112131415161718192021
  1. package me.lortseam.completeconfig.data;
  2. import org.junit.jupiter.api.Test;
  3. import static org.junit.jupiter.api.Assertions.assertEquals;
  4. import static org.junit.jupiter.api.Assertions.assertThrows;
  5. public class ConfigTest {
  6. private static final String MOD_ID = "test";
  7. @Test
  8. public void _throwExceptionIfArgNull() {
  9. NullPointerException exception = assertThrows(NullPointerException.class, () -> new Config(null));
  10. assertEquals("modId is marked non-null but is null", exception.getMessage());
  11. exception = assertThrows(NullPointerException.class, () -> new Config(MOD_ID, (String[]) null));
  12. assertEquals("branch is marked non-null but is null", exception.getMessage());
  13. assertThrows(NullPointerException.class, () -> new Config(MOD_ID, new String[]{null}));
  14. }
  15. }