Updated POM; fixed tests.
This commit is contained in:
parent
ebb3f05d78
commit
cb165e52b0
6
pom.xml
6
pom.xml
|
@ -54,12 +54,12 @@
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
<java.version>16</java.version>
|
<java.version>17</java.version>
|
||||||
<!-- Non-minecraft related dependencies -->
|
<!-- Non-minecraft related dependencies -->
|
||||||
<powermock.version>2.0.9</powermock.version>
|
<powermock.version>2.0.9</powermock.version>
|
||||||
<!-- More visible way how to change dependency versions -->
|
<!-- More visible way how to change dependency versions -->
|
||||||
<spigot.version>1.17-R0.1-SNAPSHOT</spigot.version>
|
<spigot.version>1.19.4-R0.1-SNAPSHOT</spigot.version>
|
||||||
<bentobox.version>1.18.0-SNAPSHOT</bentobox.version>
|
<bentobox.version>1.23.0-SNAPSHOT</bentobox.version>
|
||||||
<level.version>2.7.0-SNAPSHOT</level.version>
|
<level.version>2.7.0-SNAPSHOT</level.version>
|
||||||
<!-- Revision variable removes warning about dynamic version -->
|
<!-- Revision variable removes warning about dynamic version -->
|
||||||
<revision>${build.version}-SNAPSHOT</revision>
|
<revision>${build.version}-SNAPSHOT</revision>
|
||||||
|
|
|
@ -373,7 +373,6 @@ public class WarpSignsManager {
|
||||||
.getInstance()
|
.getInstance()
|
||||||
.getIWM()
|
.getIWM()
|
||||||
.getFriendlyName(actualWarp.getWorld());
|
.getFriendlyName(actualWarp.getWorld());
|
||||||
|
|
||||||
warpOwner.sendMessage("warps.player-warped", "[name]", user.getName(), "[gamemode]", gameMode);
|
warpOwner.sendMessage("warps.player-warped", "[name]", user.getName(), "[gamemode]", gameMode);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -21,7 +21,6 @@ import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
|
@ -71,7 +70,7 @@ import world.bentobox.warps.objects.WarpsData;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@RunWith(PowerMockRunner.class)
|
@RunWith(PowerMockRunner.class)
|
||||||
@PrepareForTest({Bukkit.class, Util.class, DatabaseSetup.class, ChatColor.class})
|
@PrepareForTest({Bukkit.class, Util.class, DatabaseSetup.class})
|
||||||
public class WarpSignsManagerTest {
|
public class WarpSignsManagerTest {
|
||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
|
@ -139,12 +138,15 @@ public class WarpSignsManagerTest {
|
||||||
|
|
||||||
// Player
|
// Player
|
||||||
when(player.getUniqueId()).thenReturn(uuid);
|
when(player.getUniqueId()).thenReturn(uuid);
|
||||||
|
when(player.isOnline()).thenReturn(true);
|
||||||
|
when(player.canSee(any(Player.class))).thenReturn(true);
|
||||||
User.setPlugin(plugin);
|
User.setPlugin(plugin);
|
||||||
User.getInstance(player);
|
User.getInstance(player);
|
||||||
|
|
||||||
// Locales
|
// Locales
|
||||||
LocalesManager lm = mock(LocalesManager.class);
|
LocalesManager lm = mock(LocalesManager.class);
|
||||||
when(lm.get(Mockito.any(), Mockito.any())).thenReturn(null);
|
when(lm.getAvailablePrefixes(any())).thenReturn(Collections.emptySet());
|
||||||
|
when(lm.get(Mockito.any(), Mockito.any())).thenAnswer((Answer<String>) invocation -> invocation.getArgument(1, String.class));
|
||||||
when(plugin.getLocalesManager()).thenReturn(lm);
|
when(plugin.getLocalesManager()).thenReturn(lm);
|
||||||
// Return the same string
|
// Return the same string
|
||||||
PlaceholdersManager phm = mock(PlaceholdersManager.class);
|
PlaceholdersManager phm = mock(PlaceholdersManager.class);
|
||||||
|
@ -212,6 +214,7 @@ public class WarpSignsManagerTest {
|
||||||
// IWM
|
// IWM
|
||||||
when(plugin.getIWM()).thenReturn(iwm);
|
when(plugin.getIWM()).thenReturn(iwm);
|
||||||
when(iwm.getPermissionPrefix(any())).thenReturn("bskyblock.");
|
when(iwm.getPermissionPrefix(any())).thenReturn("bskyblock.");
|
||||||
|
when(iwm.getFriendlyName(any())).thenReturn("BSkyBlock");
|
||||||
|
|
||||||
// Island Manager
|
// Island Manager
|
||||||
when(addon.getIslands()).thenReturn(im);
|
when(addon.getIslands()).thenReturn(im);
|
||||||
|
@ -425,13 +428,15 @@ public class WarpSignsManagerTest {
|
||||||
when(p.getWorld()).thenReturn(world);
|
when(p.getWorld()).thenReturn(world);
|
||||||
when(p.getName()).thenReturn("tastybento");
|
when(p.getName()).thenReturn("tastybento");
|
||||||
when(p.getLocation()).thenReturn(location);
|
when(p.getLocation()).thenReturn(location);
|
||||||
|
when(p.isOnline()).thenReturn(true);
|
||||||
|
when(p.canSee(any(Player.class))).thenReturn(true);
|
||||||
@Nullable
|
@Nullable
|
||||||
User u = User.getInstance(p);
|
User u = User.getInstance(p);
|
||||||
PowerMockito.when(Util.teleportAsync(any(), any(), any())).thenReturn(CompletableFuture.completedFuture(true));
|
PowerMockito.when(Util.teleportAsync(any(), any(), any())).thenReturn(CompletableFuture.completedFuture(true));
|
||||||
wsm.warpPlayer(world, u, uuid);
|
wsm.warpPlayer(world, u, uuid);
|
||||||
PowerMockito.verifyStatic(Util.class);
|
PowerMockito.verifyStatic(Util.class);
|
||||||
Util.teleportAsync(eq(p), any(), eq(TeleportCause.COMMAND));
|
Util.teleportAsync(eq(p), any(), eq(TeleportCause.COMMAND));
|
||||||
verify(player).sendMessage("warps.player-warped");
|
verify(player).sendMessage(anyString());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue