use of io.github.nucleuspowered.nucleus.modules.core.config.CoreConfigAdapter in project Nucleus by NucleusPowered.
the class TestModule method configure.
@Override
protected void configure() {
Path test;
Path test2;
try {
test = Files.createTempDirectory("quick");
test2 = Files.createTempFile(test, "quick", "conf");
} catch (IOException e) {
e.printStackTrace();
throw new RuntimeException(e);
}
this.bind(Path.class).annotatedWith(DefaultConfig.class).toInstance(test2);
this.bind(Path.class).annotatedWith(ConfigDir.class).toInstance(test);
this.bind(Game.class).toInstance(Mockito.mock(Game.class));
this.bind(Logger.class).toInstance(Mockito.mock(Logger.class));
CoreConfigAdapter mock = Mockito.mock(CoreConfigAdapter.class);
PowerMockito.replace(PowerMockito.method(CoreConfigAdapter.class, "getNode")).with((obj, method, arguments) -> new CoreConfig());
this.bind(CoreConfigAdapter.class).toInstance(mock);
try {
NucleusPlugin plugin = getMockPlugin();
this.bind(NucleusPlugin.class).toInstance(plugin);
this.bind(UserDataManager.class).toInstance(plugin.getUserDataManager());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
Aggregations