Fix tests

This commit is contained in:
tastybento 2022-01-02 12:25:35 -08:00
parent 5c8af0c1df
commit bfbeb7964b
2 changed files with 11 additions and 0 deletions

View File

@ -22,6 +22,7 @@ import java.util.zip.ZipOutputStream;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.Server;
import org.bukkit.block.data.BlockData;
import org.bukkit.configuration.file.YamlConfiguration;
import org.junit.After;
@ -98,6 +99,8 @@ public class BlueprintClipboardManagerTest {
" \"ySize\": 10,\n" +
" \"zSize\": 10\n" +
"}";
@Mock
private Server server;
private void zip(File targetFile) throws IOException {
try (ZipOutputStream zipOutputStream = new ZipOutputStream(new FileOutputStream(targetFile.getAbsolutePath() + BlueprintsManager.BLUEPRINT_SUFFIX))) {
@ -129,6 +132,9 @@ public class BlueprintClipboardManagerTest {
BlockData blockData = mock(BlockData.class);
when(Bukkit.createBlockData(any(Material.class))).thenReturn(blockData);
when(blockData.getAsString()).thenReturn("test123");
when(server.getBukkitVersion()).thenReturn("version");
when(Bukkit.getServer()).thenReturn(server);
}
/**

View File

@ -28,6 +28,7 @@ import java.util.jar.Manifest;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.Server;
import org.bukkit.World;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.scheduler.BukkitScheduler;
@ -93,6 +94,8 @@ public class BlueprintsManagerTest {
private BukkitTask task;
private int times;
@Mock
private Server server;
/**
* @throws java.lang.Exception
*/
@ -116,6 +119,8 @@ public class BlueprintsManagerTest {
// Scheduler
PowerMockito.mockStatic(Bukkit.class);
when(Bukkit.getScheduler()).thenReturn(scheduler);
when(server.getBukkitVersion()).thenReturn("version");
when(Bukkit.getServer()).thenReturn(server);
}