Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tastybento committed Jan 2, 2022
1 parent 5c8af0c commit bfbeb79
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

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;
Expand Down Expand Up @@ -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))) {
Expand Down Expand Up @@ -129,6 +132,9 @@ public void setUp() throws Exception {
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);

}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
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;
Expand Down Expand Up @@ -93,6 +94,8 @@ public class BlueprintsManagerTest {
private BukkitTask task;

private int times;
@Mock
private Server server;
/**
* @throws java.lang.Exception
*/
Expand All @@ -116,6 +119,8 @@ public void setUp() throws Exception {
// Scheduler
PowerMockito.mockStatic(Bukkit.class);
when(Bukkit.getScheduler()).thenReturn(scheduler);
when(server.getBukkitVersion()).thenReturn("version");
when(Bukkit.getServer()).thenReturn(server);

}

Expand Down

0 comments on commit bfbeb79

Please sign in to comment.