From 8ce553209c27f9ed51985a71472acc3447a38f4a Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Tue, 13 Apr 2021 19:16:32 +1000 Subject: [PATCH] #819: Implemented test for Material#getEquipmentSlot() method By: Jakub Zacek --- .../src/test/java/org/bukkit/PerMaterialTest.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/paper-server/src/test/java/org/bukkit/PerMaterialTest.java b/paper-server/src/test/java/org/bukkit/PerMaterialTest.java index a7d09660fb..a777d0d8fb 100644 --- a/paper-server/src/test/java/org/bukkit/PerMaterialTest.java +++ b/paper-server/src/test/java/org/bukkit/PerMaterialTest.java @@ -7,6 +7,7 @@ import java.util.List; import java.util.Map; import net.minecraft.core.BlockPosition; import net.minecraft.world.EnumHand; +import net.minecraft.world.entity.EntityInsentient; import net.minecraft.world.entity.player.EntityHuman; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemRecord; @@ -19,9 +20,11 @@ import net.minecraft.world.level.block.entity.TileEntityFurnace; import net.minecraft.world.level.block.state.BlockBase; import net.minecraft.world.level.block.state.IBlockData; import net.minecraft.world.phys.MovingObjectPositionBlock; +import org.bukkit.craftbukkit.CraftEquipmentSlot; import org.bukkit.craftbukkit.inventory.CraftItemStack; import org.bukkit.craftbukkit.util.CraftMagicNumbers; import org.bukkit.enchantments.EnchantmentTarget; +import org.bukkit.inventory.EquipmentSlot; import org.bukkit.inventory.ItemStack; import org.bukkit.support.AbstractTestingBase; import org.bukkit.support.Util; @@ -256,4 +259,12 @@ public class PerMaterialTest extends AbstractTestingBase { assertThat(material.getCraftingRemainingItem(), is(expected)); } } + + @Test + public void testEquipmentSlot() { + if (material.isItem()) { + EquipmentSlot expected = CraftEquipmentSlot.getSlot(EntityInsentient.j(CraftItemStack.asNMSCopy(new ItemStack(material)))); // PAIL rename getEquipmentSlotForItem + assertThat(material.getEquipmentSlot(), is(expected)); + } + } }