diff options
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/java/org/bukkit/PerMaterialTest.java | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/test/java/org/bukkit/PerMaterialTest.java b/src/test/java/org/bukkit/PerMaterialTest.java new file mode 100644 index 00000000..f73a9b2d --- /dev/null +++ b/src/test/java/org/bukkit/PerMaterialTest.java @@ -0,0 +1,45 @@ +package org.bukkit; + +import static org.junit.Assert.*; +import static org.hamcrest.Matchers.*; + +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.server.AchievementList; +import net.minecraft.server.Block; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameter; +import org.junit.runners.Parameterized.Parameters; + +@RunWith(Parameterized.class) +public class PerMaterialTest { + static { + AchievementList.a(); + } + + @Parameters(name= "{index}: {0}") + public static List<Object[]> data() { + List<Object[]> list = new ArrayList<Object[]>(); + for (Material material : Material.values()) { + list.add(new Object[] {material}); + } + return list; + } + + @Parameter public Material material; + + @Test + public void isSolid() { + if (material == Material.AIR) { + assertFalse(material.isSolid()); + } else if (material.isBlock()) { + assertThat(material.isSolid(), is(Block.byId[material.getId()].material.isSolid())); + } else { + assertFalse(material.isSolid()); + } + } +} |