File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
Main Plugin/src/test/java Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change 1+ import com .google .common .reflect .TypeToken ;
2+ import com .jaimemartz .playerbalancer .settings .SettingsHolder ;
3+ import ninja .leaping .configurate .commented .CommentedConfigurationNode ;
4+ import ninja .leaping .configurate .hocon .HoconConfigurationLoader ;
5+ import ninja .leaping .configurate .objectmapping .ObjectMappingException ;
6+ import org .junit .Before ;
7+ import org .junit .Test ;
8+
9+ import java .io .IOException ;
10+ import java .net .URL ;
11+
12+ public class DefaultConfigLoadTest {
13+ private URL file ;
14+
15+ @ Before
16+ public void before () throws IOException {
17+ file = getClass ().getResource ("default.conf" );
18+ }
19+
20+ @ Test
21+ public void test () throws IOException , ObjectMappingException {
22+ HoconConfigurationLoader loader = HoconConfigurationLoader
23+ .builder ()
24+ .setURL (file )
25+ .build ();
26+
27+ CommentedConfigurationNode node = loader .load ();
28+ SettingsHolder settings = node .getValue (TypeToken .of (SettingsHolder .class ));
29+
30+ System .out .println (settings );
31+ }
32+ }
You can’t perform that action at this time.
0 commit comments