mirror of
https://github.com/BentoBoxWorld/BSkyBlock.git
synced 2024-09-24 03:33:40 +02:00
Fixed tests
This commit is contained in:
parent
c5ebcb6bd9
commit
2d688b2d88
@ -24,6 +24,7 @@ import java.util.logging.Logger;
|
|||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.plugin.PluginManager;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@ -103,6 +104,7 @@ public class BSkyBlockTest {
|
|||||||
Server server = mock(Server.class);
|
Server server = mock(Server.class);
|
||||||
when(Bukkit.getServer()).thenReturn(server);
|
when(Bukkit.getServer()).thenReturn(server);
|
||||||
when(Bukkit.getLogger()).thenReturn(Logger.getAnonymousLogger());
|
when(Bukkit.getLogger()).thenReturn(Logger.getAnonymousLogger());
|
||||||
|
when(Bukkit.getPluginManager()).thenReturn(mock(PluginManager.class));
|
||||||
|
|
||||||
// Addon
|
// Addon
|
||||||
addon = new BSkyBlock();
|
addon = new BSkyBlock();
|
||||||
|
@ -19,6 +19,8 @@ import java.util.UUID;
|
|||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.plugin.PluginManager;
|
||||||
|
import org.bukkit.scheduler.BukkitScheduler;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
@ -99,6 +101,7 @@ public class IslandCommandTest {
|
|||||||
Settings settings = mock(Settings.class);
|
Settings settings = mock(Settings.class);
|
||||||
when(settings.getIslandCommand()).thenReturn("island");
|
when(settings.getIslandCommand()).thenReturn("island");
|
||||||
when(addon.getSettings()).thenReturn(settings);
|
when(addon.getSettings()).thenReturn(settings);
|
||||||
|
when(plugin.getSettings()).thenReturn(mock(world.bentobox.bentobox.Settings.class));
|
||||||
|
|
||||||
// Blueprints
|
// Blueprints
|
||||||
BlueprintsManager bpm = mock(BlueprintsManager.class);
|
BlueprintsManager bpm = mock(BlueprintsManager.class);
|
||||||
@ -112,7 +115,10 @@ public class IslandCommandTest {
|
|||||||
when(bpm.getBlueprintBundles(Mockito.any())).thenReturn(map);
|
when(bpm.getBlueprintBundles(Mockito.any())).thenReturn(map);
|
||||||
when(plugin.getBlueprintsManager()).thenReturn(bpm);
|
when(plugin.getBlueprintsManager()).thenReturn(bpm);
|
||||||
PowerMockito.mockStatic(Bukkit.class);
|
PowerMockito.mockStatic(Bukkit.class);
|
||||||
|
PluginManager pim = mock(PluginManager.class);
|
||||||
|
when(Bukkit.getPluginManager()).thenReturn(pim);
|
||||||
|
BukkitScheduler sch = mock(BukkitScheduler.class);
|
||||||
|
when(Bukkit.getScheduler()).thenReturn(sch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user