From 4d2a92ed475941088d1fee5d28992f2534ba1678 Mon Sep 17 00:00:00 2001 From: Wesley Wolfe Date: Sun, 9 Dec 2012 15:13:38 -0600 Subject: [PATCH] Add isSolid() tests for each material --- pom.xml | 15 +------ src/test/java/org/bukkit/PerMaterialTest.java | 45 +++++++++++++++++++ 2 files changed, 47 insertions(+), 13 deletions(-) create mode 100644 src/test/java/org/bukkit/PerMaterialTest.java diff --git a/pom.xml b/pom.xml index 097af98e5b..74be044951 100644 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ UTF-8 unknown - 4.10 + 4.11 1.4.5 1_4_5 @@ -135,15 +135,9 @@ junit - junit-dep + junit ${junit.version} test - - - hamcrest-core - org.hamcrest - - org.hamcrest @@ -275,11 +269,6 @@ net.minecraft.server.v${minecraft_version} - - - junit:junit - - diff --git a/src/test/java/org/bukkit/PerMaterialTest.java b/src/test/java/org/bukkit/PerMaterialTest.java new file mode 100644 index 0000000000..f73a9b2dba --- /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 data() { + List list = new ArrayList(); + 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()); + } + } +}