Skip to content

Commit cb165e5

Browse files
committed
Updated POM; fixed tests.
1 parent ebb3f05 commit cb165e5

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,12 @@
5454
<properties>
5555
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
5656
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
57-
<java.version>16</java.version>
57+
<java.version>17</java.version>
5858
<!-- Non-minecraft related dependencies -->
5959
<powermock.version>2.0.9</powermock.version>
6060
<!-- More visible way how to change dependency versions -->
61-
<spigot.version>1.17-R0.1-SNAPSHOT</spigot.version>
62-
<bentobox.version>1.18.0-SNAPSHOT</bentobox.version>
61+
<spigot.version>1.19.4-R0.1-SNAPSHOT</spigot.version>
62+
<bentobox.version>1.23.0-SNAPSHOT</bentobox.version>
6363
<level.version>2.7.0-SNAPSHOT</level.version>
6464
<!-- Revision variable removes warning about dynamic version -->
6565
<revision>${build.version}-SNAPSHOT</revision>

src/main/java/world/bentobox/warps/managers/WarpSignsManager.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,6 @@ private void warpPlayer(@NonNull User user, @NonNull Location inFront, @NonNull
373373
.getInstance()
374374
.getIWM()
375375
.getFriendlyName(actualWarp.getWorld());
376-
377376
warpOwner.sendMessage("warps.player-warped", "[name]", user.getName(), "[gamemode]", gameMode);
378377
}
379378
});

src/test/java/world/bentobox/warps/WarpSignsManagerTest.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import java.util.logging.Logger;
2222

2323
import org.bukkit.Bukkit;
24-
import org.bukkit.ChatColor;
2524
import org.bukkit.Location;
2625
import org.bukkit.Material;
2726
import org.bukkit.OfflinePlayer;
@@ -71,7 +70,7 @@
7170
*
7271
*/
7372
@RunWith(PowerMockRunner.class)
74-
@PrepareForTest({Bukkit.class, Util.class, DatabaseSetup.class, ChatColor.class})
73+
@PrepareForTest({Bukkit.class, Util.class, DatabaseSetup.class})
7574
public class WarpSignsManagerTest {
7675

7776
@Mock
@@ -139,12 +138,15 @@ public void setUp() throws Exception {
139138

140139
// Player
141140
when(player.getUniqueId()).thenReturn(uuid);
141+
when(player.isOnline()).thenReturn(true);
142+
when(player.canSee(any(Player.class))).thenReturn(true);
142143
User.setPlugin(plugin);
143144
User.getInstance(player);
144145

145146
// Locales
146147
LocalesManager lm = mock(LocalesManager.class);
147-
when(lm.get(Mockito.any(), Mockito.any())).thenReturn(null);
148+
when(lm.getAvailablePrefixes(any())).thenReturn(Collections.emptySet());
149+
when(lm.get(Mockito.any(), Mockito.any())).thenAnswer((Answer<String>) invocation -> invocation.getArgument(1, String.class));
148150
when(plugin.getLocalesManager()).thenReturn(lm);
149151
// Return the same string
150152
PlaceholdersManager phm = mock(PlaceholdersManager.class);
@@ -212,6 +214,7 @@ public void setUp() throws Exception {
212214
// IWM
213215
when(plugin.getIWM()).thenReturn(iwm);
214216
when(iwm.getPermissionPrefix(any())).thenReturn("bskyblock.");
217+
when(iwm.getFriendlyName(any())).thenReturn("BSkyBlock");
215218

216219
// Island Manager
217220
when(addon.getIslands()).thenReturn(im);
@@ -425,13 +428,15 @@ public void testWarpPlayer() {
425428
when(p.getWorld()).thenReturn(world);
426429
when(p.getName()).thenReturn("tastybento");
427430
when(p.getLocation()).thenReturn(location);
431+
when(p.isOnline()).thenReturn(true);
432+
when(p.canSee(any(Player.class))).thenReturn(true);
428433
@Nullable
429434
User u = User.getInstance(p);
430435
PowerMockito.when(Util.teleportAsync(any(), any(), any())).thenReturn(CompletableFuture.completedFuture(true));
431436
wsm.warpPlayer(world, u, uuid);
432437
PowerMockito.verifyStatic(Util.class);
433438
Util.teleportAsync(eq(p), any(), eq(TeleportCause.COMMAND));
434-
verify(player).sendMessage("warps.player-warped");
439+
verify(player).sendMessage(anyString());
435440
}
436441

437442
/**

0 commit comments

Comments
 (0)