mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-22 02:35:21 +01:00
Fix tests
This commit is contained in:
parent
8e3f368602
commit
8d75bc697b
@ -527,9 +527,10 @@ public class User implements MetaDataAble {
|
||||
|
||||
// Replace game mode and friendly name in general
|
||||
// Replace the [gamemode] text variable
|
||||
translation = translation.replace("[gamemode]",
|
||||
addon != null ? addon.getDescription().getName() : "[gamemode]");
|
||||
if (getWorld() != null) {
|
||||
if (addon != null && addon.getDescription() != null) {
|
||||
translation = translation.replace("[gamemode]", addon.getDescription().getName());
|
||||
}
|
||||
if (player != null && player.getWorld() != null) {
|
||||
// Replace the [friendly_name] text variable
|
||||
translation = translation.replace("[friendly_name]",
|
||||
isPlayer() ? plugin.getIWM().getFriendlyName(getWorld()) : "[friendly_name]");
|
||||
|
@ -127,6 +127,7 @@ public class IslandSpawnCommandTest {
|
||||
when(plugin.getSettings()).thenReturn(s);
|
||||
|
||||
// IWM
|
||||
when(iwm.getFriendlyName(any())).thenReturn("BSkyBlock");
|
||||
when(plugin.getIWM()).thenReturn(iwm);
|
||||
when(iwm.getWorldSettings(any())).thenReturn(ws);
|
||||
map = new HashMap<>();
|
||||
|
@ -120,6 +120,7 @@ public class IslandTeamLeaveCommandTest {
|
||||
when(Bukkit.getScheduler()).thenReturn(sch);
|
||||
|
||||
// Island World Manager
|
||||
when(iwm.getFriendlyName(any())).thenReturn("BSkyBlock");
|
||||
when(plugin.getIWM()).thenReturn(iwm);
|
||||
|
||||
// Plugin Manager
|
||||
|
@ -935,7 +935,7 @@ public class UserTest {
|
||||
when(addon.getDescription()).thenReturn(new Builder("main", "gameAddon", "1.0").build());
|
||||
p.setAddon(addon);
|
||||
p.getTranslation(TEST_TRANSLATION);
|
||||
verify(addon, times(2)).getDescription();
|
||||
verify(addon, times(3)).getDescription();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -77,6 +77,7 @@ public class BannedCommandsTest {
|
||||
when(iwm.getPermissionPrefix(any())).thenReturn("bskyblock.");
|
||||
when(iwm.getVisitorBannedCommands(any())).thenReturn(new ArrayList<>());
|
||||
when(iwm.getFallingBannedCommands(any())).thenReturn(new ArrayList<>());
|
||||
when(iwm.getFriendlyName(any())).thenReturn("BSkyBlock");
|
||||
WorldSettings ws = new MyWorldSettings();
|
||||
when(iwm.getWorldSettings(any())).thenReturn(ws);
|
||||
when(plugin.getIWM()).thenReturn(iwm);
|
||||
|
@ -134,6 +134,7 @@ public class JoinLeaveListenerTest {
|
||||
when(iwm.getAddon(any())).thenReturn(opGm);
|
||||
when(gameMode.getPermissionPrefix()).thenReturn("acidisland.");
|
||||
when(iwm.getIslandDistance(any())).thenReturn(100);
|
||||
when(iwm.getFriendlyName(any())).thenReturn("BSkyBlock");
|
||||
|
||||
UUID uuid = UUID.randomUUID();
|
||||
// Player
|
||||
|
@ -110,6 +110,7 @@ public class StandardSpawnProtectionListenerTest extends AbstractCommonSetup {
|
||||
when(iwm.inWorld(any(World.class))).thenReturn(true);
|
||||
when(iwm.getNetherSpawnRadius(any())).thenReturn(25);
|
||||
when(iwm.getWorldSettings(any())).thenReturn(ws);
|
||||
when(iwm.getFriendlyName(any())).thenReturn("BSkyBlock");
|
||||
// Util
|
||||
PowerMockito.mockStatic(Util.class);
|
||||
when(Util.getWorld(any())).thenReturn(world);
|
||||
|
@ -138,6 +138,7 @@ public abstract class AbstractCommonSetup {
|
||||
when(plugin.getIWM()).thenReturn(iwm);
|
||||
when(iwm.inWorld(any(Location.class))).thenReturn(true);
|
||||
when(iwm.inWorld(any(World.class))).thenReturn(true);
|
||||
when(iwm.getFriendlyName(any())).thenReturn("BSkyBlock");
|
||||
// Addon
|
||||
when(iwm.getAddon(any())).thenReturn(Optional.empty());
|
||||
|
||||
|
@ -136,6 +136,7 @@ public class PVPListenerTest {
|
||||
when(iwm.inWorld(any(World.class))).thenReturn(true);
|
||||
when(iwm.inWorld(any(Location.class))).thenReturn(true);
|
||||
when(iwm.getPermissionPrefix(Mockito.any())).thenReturn("bskyblock.");
|
||||
when(iwm.getFriendlyName(any())).thenReturn("BSkyBlock");
|
||||
// No visitor protection right now
|
||||
when(iwm.getIvSettings(any())).thenReturn(new ArrayList<>());
|
||||
when(plugin.getIWM()).thenReturn(iwm);
|
||||
|
@ -114,6 +114,7 @@ public class ObsidianScoopingListenerTest {
|
||||
when(iwm.getIslandWorld(Mockito.any())).thenReturn(world);
|
||||
when(iwm.getNetherWorld(Mockito.any())).thenReturn(world);
|
||||
when(iwm.getEndWorld(Mockito.any())).thenReturn(world);
|
||||
when(iwm.getFriendlyName(any())).thenReturn("BSkyBlock");
|
||||
|
||||
// Mock up IslandsManager
|
||||
when(plugin.getIslands()).thenReturn(im);
|
||||
|
Loading…
Reference in New Issue
Block a user