diff --git a/src/main/java/world/bentobox/level/LevelsManager.java b/src/main/java/world/bentobox/level/LevelsManager.java index 28064fa..46d47b3 100644 --- a/src/main/java/world/bentobox/level/LevelsManager.java +++ b/src/main/java/world/bentobox/level/LevelsManager.java @@ -414,7 +414,7 @@ public class LevelsManager { addon.log("Generating rankings"); handler.loadObjects().forEach(il -> { if (il.getLevel() > 0) { -\ // Load islands, but don't cache them + // Load islands, but don't cache them addon.getIslands().getIslandById(il.getUniqueId(), false) .ifPresent(i -> this.addToTopTen(i, il.getLevel())); } diff --git a/src/test/java/world/bentobox/level/LevelTest.java b/src/test/java/world/bentobox/level/LevelTest.java index 02cb04e..7da610f 100644 --- a/src/test/java/world/bentobox/level/LevelTest.java +++ b/src/test/java/world/bentobox/level/LevelTest.java @@ -61,6 +61,7 @@ import world.bentobox.bentobox.managers.FlagsManager; import world.bentobox.bentobox.managers.IslandWorldManager; import world.bentobox.bentobox.managers.IslandsManager; import world.bentobox.bentobox.managers.PlaceholdersManager; +import world.bentobox.bentobox.util.Util; import world.bentobox.level.config.BlockConfig; import world.bentobox.level.config.ConfigSettings; import world.bentobox.level.listeners.IslandActivitiesListeners; @@ -72,7 +73,7 @@ import world.bentobox.level.listeners.JoinLeaveListener; */ @SuppressWarnings("deprecation") @RunWith(PowerMockRunner.class) -@PrepareForTest({ Bukkit.class, BentoBox.class, User.class }) +@PrepareForTest({ Bukkit.class, BentoBox.class, User.class, Util.class }) public class LevelTest { private static File jFile; @@ -189,6 +190,11 @@ public class LevelTest { when(Bukkit.getServer()).thenReturn(server); when(Bukkit.getLogger()).thenReturn(Logger.getAnonymousLogger()); 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 = new Level(); @@ -221,7 +227,6 @@ public class LevelTest { when(fm.getFlags()).thenReturn(Collections.emptyList()); // Bukkit - PowerMockito.mockStatic(Bukkit.class); when(Bukkit.getScheduler()).thenReturn(scheduler); ItemMeta meta = mock(ItemMeta.class); ItemFactory itemFactory = mock(ItemFactory.class);