From e3c01e2bf0a161256c134c278879829a6de219ae Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Tue, 23 Nov 2021 08:07:10 +1100 Subject: [PATCH] #955: Add test for BlockData class of Material By: BlackHole --- .../src/test/java/org/bukkit/PerMaterialTest.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/paper-server/src/test/java/org/bukkit/PerMaterialTest.java b/paper-server/src/test/java/org/bukkit/PerMaterialTest.java index 2dc199c974..7d4d2f560e 100644 --- a/paper-server/src/test/java/org/bukkit/PerMaterialTest.java +++ b/paper-server/src/test/java/org/bukkit/PerMaterialTest.java @@ -20,12 +20,14 @@ 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.block.data.BlockData; 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.material.MaterialData; import org.bukkit.support.AbstractTestingBase; import org.junit.BeforeClass; import org.junit.Test; @@ -273,4 +275,15 @@ public class PerMaterialTest extends AbstractTestingBase { assertThat(material.getEquipmentSlot(), is(expected)); } } + + @Test + public void testBlockDataClass() { + if (material.isBlock()) { + Class expectedClass = material.data; + if (expectedClass != MaterialData.class) { + BlockData blockData = Bukkit.createBlockData(material); + assertTrue(expectedClass + " <> " + blockData.getClass(), expectedClass.isInstance(blockData)); + } + } + } }