Fixed tests

This commit is contained in:
tastybento 2019-07-18 18:53:23 -07:00
parent c5ebcb6bd9
commit 2d688b2d88
2 changed files with 9 additions and 1 deletions

View File

@ -24,6 +24,7 @@ import java.util.logging.Logger;
import org.bukkit.Bukkit;
import org.bukkit.Server;
import org.bukkit.entity.Player;
import org.bukkit.plugin.PluginManager;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@ -103,6 +104,7 @@ public class BSkyBlockTest {
Server server = mock(Server.class);
when(Bukkit.getServer()).thenReturn(server);
when(Bukkit.getLogger()).thenReturn(Logger.getAnonymousLogger());
when(Bukkit.getPluginManager()).thenReturn(mock(PluginManager.class));
// Addon
addon = new BSkyBlock();

View File

@ -19,6 +19,8 @@ import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.plugin.PluginManager;
import org.bukkit.scheduler.BukkitScheduler;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@ -99,6 +101,7 @@ public class IslandCommandTest {
Settings settings = mock(Settings.class);
when(settings.getIslandCommand()).thenReturn("island");
when(addon.getSettings()).thenReturn(settings);
when(plugin.getSettings()).thenReturn(mock(world.bentobox.bentobox.Settings.class));
// Blueprints
BlueprintsManager bpm = mock(BlueprintsManager.class);
@ -112,7 +115,10 @@ public class IslandCommandTest {
when(bpm.getBlueprintBundles(Mockito.any())).thenReturn(map);
when(plugin.getBlueprintsManager()).thenReturn(bpm);
PowerMockito.mockStatic(Bukkit.class);
PluginManager pim = mock(PluginManager.class);
when(Bukkit.getPluginManager()).thenReturn(pim);
BukkitScheduler sch = mock(BukkitScheduler.class);
when(Bukkit.getScheduler()).thenReturn(sch);
}