Skip to content

Commit

Permalink
Test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tastybento committed Jun 30, 2024
1 parent e374dbd commit c065379
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/main/java/world/bentobox/level/LevelsManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ public void loadTopTens() {
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()));
}
Expand Down
9 changes: 7 additions & 2 deletions src/test/java/world/bentobox/level/LevelTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
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;
Expand All @@ -72,7 +73,7 @@
*/
@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;
Expand Down Expand Up @@ -189,6 +190,11 @@ public void setUp() throws Exception {
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();
Expand Down Expand Up @@ -221,7 +227,6 @@ public void setUp() throws Exception {
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);
Expand Down

0 comments on commit c065379

Please sign in to comment.