mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-27 21:27:44 +01:00
Improved PanelItemBuilder test class
This commit is contained in:
parent
91dec86b5a
commit
ac079a6686
@ -24,10 +24,12 @@ import org.bukkit.inventory.ItemFactory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.SkullMeta;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mockito;
|
||||
import org.powermock.api.mockito.PowerMockito;
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
|
||||
import world.bentobox.bentobox.api.panels.Panel;
|
||||
@ -35,12 +37,15 @@ import world.bentobox.bentobox.api.panels.PanelItem;
|
||||
import world.bentobox.bentobox.api.user.User;
|
||||
|
||||
@RunWith(PowerMockRunner.class)
|
||||
@PrepareForTest( {Bukkit.class})
|
||||
public class PanelItemBuilderTest {
|
||||
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@BeforeClass
|
||||
public static void setUp() throws Exception {
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
PowerMockito.mockStatic(Bukkit.class);
|
||||
|
||||
Server server = mock(Server.class);
|
||||
World world = mock(World.class);
|
||||
world = mock(World.class);
|
||||
@ -54,8 +59,6 @@ public class PanelItemBuilderTest {
|
||||
ItemFactory itemFactory = mock(ItemFactory.class);
|
||||
when(server.getItemFactory()).thenReturn(itemFactory);
|
||||
|
||||
Bukkit.setServer(server);
|
||||
|
||||
SkullMeta skullMeta = mock(SkullMeta.class);
|
||||
when(skullMeta.getOwner()).thenReturn("tastybento");
|
||||
when(itemFactory.getItemMeta(any())).thenReturn(skullMeta);
|
||||
|
Loading…
Reference in New Issue
Block a user