use of io.github.nucleuspowered.nucleus.internal.PermissionRegistry in project Nucleus by NucleusPowered.
the class TestModule method getMockPlugin.
private NucleusPlugin getMockPlugin() {
NucleusPlugin plugin = Mockito.mock(NucleusPlugin.class);
PermissionRegistry pr = new PermissionRegistry();
Mockito.when(plugin.getMessageProvider()).thenReturn(new ResourceMessageProvider(ResourceMessageProvider.messagesBundle));
Mockito.when(plugin.getPermissionRegistry()).thenReturn(pr);
Mockito.when(plugin.getUserDataManager()).thenReturn(Mockito.mock(UserDataManager.class));
/*
Field f = Nucleus.class.getDeclaredField("nucleus");
f.setAccessible(true);
f.set(null, plugin);
*/
try {
Path file = Files.createTempFile("quickstartcmdtest", "conf");
CommandsConfig cc = new CommandsConfig(file);
Mockito.when(plugin.getCommandsConfig()).thenReturn(cc);
return plugin;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
Aggregations