From bdcc7c7b02947498f0c9b5adfd4a66bc1600d2cf Mon Sep 17 00:00:00 2001 From: md_5 Date: Tue, 16 Jan 2018 09:57:47 +1100 Subject: Unit tests for Material.isItem --- src/test/java/org/bukkit/PerMaterialTest.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/test/java/org/bukkit/PerMaterialTest.java b/src/test/java/org/bukkit/PerMaterialTest.java index eabe68d7..1e8d53c6 100644 --- a/src/test/java/org/bukkit/PerMaterialTest.java +++ b/src/test/java/org/bukkit/PerMaterialTest.java @@ -162,4 +162,22 @@ public class PerMaterialTest extends AbstractTestingBase { assertFalse(EnchantmentTarget.BREAKABLE.includes(material)); } } + + @Test + public void testBlock() { + if (material == Material.AIR) { + assertTrue(material.isBlock()); + } else { + assertThat(material.isBlock(), is(equalTo(CraftMagicNumbers.getBlock(material) != Blocks.AIR))); + } + } + + @Test + public void testAir() { + if (material == Material.AIR) { + assertTrue(material.isItem()); + } else { + assertThat(material.isItem(), is(equalTo(CraftMagicNumbers.getItem(material) != null))); + } + } } -- cgit v1.2.3