|
40 | 40 | import org.powermock.modules.junit4.PowerMockRunner;
|
41 | 41 |
|
42 | 42 | import world.bentobox.bentobox.BentoBox;
|
| 43 | +import world.bentobox.bentobox.api.addons.GameModeAddon; |
43 | 44 | import world.bentobox.bentobox.api.events.island.IslandProtectionRangeChangeEvent;
|
44 | 45 | import world.bentobox.bentobox.api.user.User;
|
45 | 46 | import world.bentobox.bentobox.database.objects.Island;
|
| 47 | +import world.bentobox.bentobox.managers.IslandWorldManager; |
46 | 48 | import world.bentobox.bentobox.managers.IslandsManager;
|
47 | 49 | import world.bentobox.bentobox.util.Util;
|
48 | 50 | import world.bentobox.border.Border;
|
@@ -82,6 +84,10 @@ public class PlayerListenerTest {
|
82 | 84 | private Island island;
|
83 | 85 | @Mock
|
84 | 86 | private Vehicle vehicle;
|
| 87 | + @Mock |
| 88 | + private IslandWorldManager iwm; |
| 89 | + @Mock |
| 90 | + private GameModeAddon gma; |
85 | 91 |
|
86 | 92 |
|
87 | 93 | /**
|
@@ -135,6 +141,15 @@ public void setUp() throws Exception {
|
135 | 141 | // Util
|
136 | 142 | PowerMockito.mockStatic(Util.class, Mockito.RETURNS_MOCKS);
|
137 | 143 |
|
| 144 | + // Plugin |
| 145 | + when(addon.getPlugin()).thenReturn(plugin); |
| 146 | + |
| 147 | + // IWM |
| 148 | + when(gma.getPermissionPrefix()).thenReturn("bskyblock."); |
| 149 | + when(iwm.getAddon(world)).thenReturn(Optional.of(gma)); |
| 150 | + when(plugin.getIWM()).thenReturn(iwm); |
| 151 | + |
| 152 | + |
138 | 153 | pl = new PlayerListener(addon);
|
139 | 154 |
|
140 | 155 | }
|
@@ -178,7 +193,7 @@ public void testOnPlayerQuit() {
|
178 | 193 | */
|
179 | 194 | @Test
|
180 | 195 | public void testOnPlayerRespawn() {
|
181 |
| - PlayerRespawnEvent event = new PlayerRespawnEvent(player, null, false, false); |
| 196 | + PlayerRespawnEvent event = new PlayerRespawnEvent(player, from, false, false, null); |
182 | 197 | pl.onPlayerRespawn(event);
|
183 | 198 | PowerMockito.verifyStatic(Bukkit.class);
|
184 | 199 | Bukkit.getScheduler();
|
|
0 commit comments