Fixed erroring tests

This commit is contained in:
Florian CUNY 2020-01-18 09:52:02 +01:00
parent 0ffa1ab86a
commit e17056376a
3 changed files with 15 additions and 0 deletions

View File

@ -15,11 +15,13 @@ import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.PluginManager;
import org.bukkit.scheduler.BukkitScheduler;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.stubbing.Answer;
import org.powermock.api.mockito.PowerMockito;
@ -51,6 +53,8 @@ public class AdminRangeResetCommandTest {
private User user;
private IslandsManager im;
private PlayersManager pm;
@Mock
private PluginManager pim;
/**
@ -113,6 +117,7 @@ public class AdminRangeResetCommandTest {
BukkitScheduler sch = mock(BukkitScheduler.class);
PowerMockito.mockStatic(Bukkit.class);
when(Bukkit.getScheduler()).thenReturn(sch);
when(Bukkit.getPluginManager()).thenReturn(pim);
// Locales
LocalesManager lm = mock(LocalesManager.class);

View File

@ -15,11 +15,13 @@ import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.PluginManager;
import org.bukkit.scheduler.BukkitScheduler;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.stubbing.Answer;
import org.powermock.api.mockito.PowerMockito;
@ -51,6 +53,8 @@ public class AdminRangeSetCommandTest {
private User user;
private IslandsManager im;
private PlayersManager pm;
@Mock
private PluginManager pim;
/**
@ -115,6 +119,7 @@ public class AdminRangeSetCommandTest {
BukkitScheduler sch = mock(BukkitScheduler.class);
PowerMockito.mockStatic(Bukkit.class);
when(Bukkit.getScheduler()).thenReturn(sch);
when(Bukkit.getPluginManager()).thenReturn(pim);
// Locales
LocalesManager lm = mock(LocalesManager.class);

View File

@ -27,6 +27,7 @@ import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.PlayerInventory;
import org.bukkit.permissions.PermissionAttachmentInfo;
import org.bukkit.plugin.PluginManager;
import org.bukkit.scheduler.BukkitScheduler;
import org.eclipse.jdt.annotation.Nullable;
import org.junit.After;
@ -96,6 +97,8 @@ public class JoinLeaveListenerTest {
private @Nullable Island island;
@Mock
private GameModeAddon gameMode;
@Mock
private PluginManager pim;
/**
* @throws java.lang.Exception
@ -167,6 +170,8 @@ public class JoinLeaveListenerTest {
PowerMockito.mockStatic(Bukkit.class);
when(Bukkit.getScheduler()).thenReturn(scheduler);
when(Bukkit.getPluginManager()).thenReturn(pim);
// Bukkit - online players
Map<UUID, String> online = new HashMap<>();