mirror of
https://github.com/BGHDDevelopment/PlayerBalancer.git
synced 2024-11-27 05:05:19 +01:00
Added unit test for the config
This commit is contained in:
parent
71ffd842db
commit
bd5cf508c9
32
Main Plugin/src/test/java/DefaultConfigLoadTest.java
Normal file
32
Main Plugin/src/test/java/DefaultConfigLoadTest.java
Normal file
@ -0,0 +1,32 @@
|
||||
import com.google.common.reflect.TypeToken;
|
||||
import com.jaimemartz.playerbalancer.settings.SettingsHolder;
|
||||
import ninja.leaping.configurate.commented.CommentedConfigurationNode;
|
||||
import ninja.leaping.configurate.hocon.HoconConfigurationLoader;
|
||||
import ninja.leaping.configurate.objectmapping.ObjectMappingException;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
|
||||
public class DefaultConfigLoadTest {
|
||||
private URL file;
|
||||
|
||||
@Before
|
||||
public void before() throws IOException {
|
||||
file = getClass().getResource("default.conf");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test() throws IOException, ObjectMappingException {
|
||||
HoconConfigurationLoader loader = HoconConfigurationLoader
|
||||
.builder()
|
||||
.setURL(file)
|
||||
.build();
|
||||
|
||||
CommentedConfigurationNode node = loader.load();
|
||||
SettingsHolder settings = node.getValue(TypeToken.of(SettingsHolder.class));
|
||||
|
||||
System.out.println(settings);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user