mirror of
https://github.com/BentoBoxWorld/Level.git
synced 2025-02-16 12:31:22 +01:00
Test fixes
This commit is contained in:
parent
e374dbd1c1
commit
c0653790b1
@ -414,7 +414,7 @@ public class LevelsManager {
|
|||||||
addon.log("Generating rankings");
|
addon.log("Generating rankings");
|
||||||
handler.loadObjects().forEach(il -> {
|
handler.loadObjects().forEach(il -> {
|
||||||
if (il.getLevel() > 0) {
|
if (il.getLevel() > 0) {
|
||||||
\ // Load islands, but don't cache them
|
// Load islands, but don't cache them
|
||||||
addon.getIslands().getIslandById(il.getUniqueId(), false)
|
addon.getIslands().getIslandById(il.getUniqueId(), false)
|
||||||
.ifPresent(i -> this.addToTopTen(i, il.getLevel()));
|
.ifPresent(i -> this.addToTopTen(i, il.getLevel()));
|
||||||
}
|
}
|
||||||
|
@ -61,6 +61,7 @@ import world.bentobox.bentobox.managers.FlagsManager;
|
|||||||
import world.bentobox.bentobox.managers.IslandWorldManager;
|
import world.bentobox.bentobox.managers.IslandWorldManager;
|
||||||
import world.bentobox.bentobox.managers.IslandsManager;
|
import world.bentobox.bentobox.managers.IslandsManager;
|
||||||
import world.bentobox.bentobox.managers.PlaceholdersManager;
|
import world.bentobox.bentobox.managers.PlaceholdersManager;
|
||||||
|
import world.bentobox.bentobox.util.Util;
|
||||||
import world.bentobox.level.config.BlockConfig;
|
import world.bentobox.level.config.BlockConfig;
|
||||||
import world.bentobox.level.config.ConfigSettings;
|
import world.bentobox.level.config.ConfigSettings;
|
||||||
import world.bentobox.level.listeners.IslandActivitiesListeners;
|
import world.bentobox.level.listeners.IslandActivitiesListeners;
|
||||||
@ -72,7 +73,7 @@ import world.bentobox.level.listeners.JoinLeaveListener;
|
|||||||
*/
|
*/
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
@RunWith(PowerMockRunner.class)
|
@RunWith(PowerMockRunner.class)
|
||||||
@PrepareForTest({ Bukkit.class, BentoBox.class, User.class })
|
@PrepareForTest({ Bukkit.class, BentoBox.class, User.class, Util.class })
|
||||||
public class LevelTest {
|
public class LevelTest {
|
||||||
|
|
||||||
private static File jFile;
|
private static File jFile;
|
||||||
@ -189,6 +190,11 @@ public class LevelTest {
|
|||||||
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));
|
when(Bukkit.getPluginManager()).thenReturn(mock(PluginManager.class));
|
||||||
|
when(Bukkit.getBukkitVersion()).thenReturn("");
|
||||||
|
|
||||||
|
// Util
|
||||||
|
PowerMockito.mockStatic(Util.class, Mockito.RETURNS_MOCKS);
|
||||||
|
when(Util.inTest()).thenReturn(true);
|
||||||
|
|
||||||
// Addon
|
// Addon
|
||||||
addon = new Level();
|
addon = new Level();
|
||||||
@ -221,7 +227,6 @@ public class LevelTest {
|
|||||||
when(fm.getFlags()).thenReturn(Collections.emptyList());
|
when(fm.getFlags()).thenReturn(Collections.emptyList());
|
||||||
|
|
||||||
// Bukkit
|
// Bukkit
|
||||||
PowerMockito.mockStatic(Bukkit.class);
|
|
||||||
when(Bukkit.getScheduler()).thenReturn(scheduler);
|
when(Bukkit.getScheduler()).thenReturn(scheduler);
|
||||||
ItemMeta meta = mock(ItemMeta.class);
|
ItemMeta meta = mock(ItemMeta.class);
|
||||||
ItemFactory itemFactory = mock(ItemFactory.class);
|
ItemFactory itemFactory = mock(ItemFactory.class);
|
||||||
|
Loading…
Reference in New Issue
Block a user