summaryrefslogtreecommitdiffstats
path: root/src/test/java/org/bukkit/MaterialTest.java
diff options
context:
space:
mode:
authorWesley Wolfe <weswolf@aol.com>2012-12-14 02:02:02 -0600
committerWesley Wolfe <weswolf@aol.com>2012-12-14 02:02:02 -0600
commit0f4c206f9b256c441a142b0be68a4a76421c2911 (patch)
tree980ba23c5ac389461a518af3c69b12a4c9008214 /src/test/java/org/bukkit/MaterialTest.java
parent53b064ec79c62f34ca98dd08b0ae4cc04e51a81f (diff)
downloadcraftbukkit-0f4c206f9b256c441a142b0be68a4a76421c2911.tar
craftbukkit-0f4c206f9b256c441a142b0be68a4a76421c2911.tar.gz
craftbukkit-0f4c206f9b256c441a142b0be68a4a76421c2911.tar.lz
craftbukkit-0f4c206f9b256c441a142b0be68a4a76421c2911.tar.xz
craftbukkit-0f4c206f9b256c441a142b0be68a4a76421c2911.zip
Add isRecord and new material method tests.
Cleaned up all of the CraftBukkit tests, including moving some tests from MaterialTest to PerMaterialTest.
Diffstat (limited to 'src/test/java/org/bukkit/MaterialTest.java')
-rw-r--r--src/test/java/org/bukkit/MaterialTest.java41
1 files changed, 6 insertions, 35 deletions
diff --git a/src/test/java/org/bukkit/MaterialTest.java b/src/test/java/org/bukkit/MaterialTest.java
index f4464fd8..dbb60de0 100644
--- a/src/test/java/org/bukkit/MaterialTest.java
+++ b/src/test/java/org/bukkit/MaterialTest.java
@@ -1,14 +1,12 @@
package org.bukkit;
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.Matchers.hasSize;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertThat;
+import static org.junit.Assert.*;
+import static org.hamcrest.Matchers.*;
+import java.util.Collections;
import java.util.Map;
import net.minecraft.server.Item;
-import net.minecraft.server.ItemFood;
import org.bukkit.support.AbstractTestingBase;
import org.junit.Test;
@@ -16,6 +14,7 @@ import org.junit.Test;
import com.google.common.collect.Maps;
public class MaterialTest extends AbstractTestingBase {
+
@Test
public void verifyMapping() {
Map<Integer, Material> materials = Maps.newHashMap();
@@ -29,40 +28,12 @@ public class MaterialTest extends AbstractTestingBase {
int id = item.id;
String name = item.getName();
- int maxStackSize = item.getMaxStackSize();
- int maxDurability = item.getMaxDurability();
-
- Material material = materials.remove(id);
-
- assertNotNull(String.format("org.bukkit.Material is missing id: %d named: %s", id, name), material);
-
- assertThat(String.format("org.bukkit.Material.%s maxStackSize:", material), material.getMaxStackSize(), is(maxStackSize));
- assertThat(String.format("org.bukkit.Material.%s maxDurability:", material), material.getMaxDurability(), is((short) maxDurability));
- }
-
- assertThat("org.bukkit.Material has too many entries", materials.values(), hasSize(0));
- }
-
- @Test
- public void verifyIsEdible() {
- Map<Integer, Material> materials = Maps.newHashMap();
- for (Material material : Material.values()) {
- if (!material.isEdible()) continue;
- materials.put(material.getId(), material);
- }
-
- for (Item item : Item.byId) {
- if (item == null) continue;
- if (!(item instanceof ItemFood)) continue;
-
- int id = item.id;
- String name = item.getName();
Material material = materials.remove(id);
- assertNotNull(String.format("org.bukkit.Material does not list id: %d named: %s edible", id, name), material);
+ assertThat("Missing " + name + "(" + id + ")", material, is(not(nullValue())));
}
- assertThat("org.bukkit.Material has entries marked edible that are not ItemFood", materials.values(), hasSize(0));
+ assertThat(materials, is(Collections.EMPTY_MAP));
}
}