Skip to content

Commit

Permalink
Added tests for null type provided to particle parser
Browse files Browse the repository at this point in the history
  • Loading branch information
fulminazzo committed Apr 9, 2024
1 parent 98eeac7 commit ce825ce
Showing 1 changed file with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
import it.angrybear.yagl.parsers.WrappersYAGLParser;
import it.angrybear.yagl.wrappers.Potion;
import it.fulminazzo.fulmicollection.utils.ReflectionUtils;
import it.fulminazzo.yamlparser.configuration.ConfigurationSection;
import it.fulminazzo.yamlparser.configuration.FileConfiguration;
import it.fulminazzo.yamlparser.utils.FileUtils;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;

Expand All @@ -16,8 +18,7 @@
import java.util.Arrays;
import java.util.stream.Stream;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.*;

class ParticleParserTest extends ParserTestHelper<Particle> {

Expand Down Expand Up @@ -88,6 +89,16 @@ void testTypes(AParticleType<?> type) throws IOException {
}
}

@Test
void testNullType() {
WrappersYAGLParser.addAllParsers();
ConfigurationSection particleSection = new ConfigurationSection(null, "main");
particleSection.set("particle.type", null);

assertThrowsExactly(IllegalArgumentException.class, () ->
particleSection.get("particle", Particle.class));
}

@Override
protected Class<?> getParser() {
return ParticleParser.class;
Expand Down

0 comments on commit ce825ce

Please sign in to comment.