diff options
Diffstat (limited to 'src/test/java')
-rw-r--r-- | src/test/java/org/bukkit/MaterialTest.java | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/test/java/org/bukkit/MaterialTest.java b/src/test/java/org/bukkit/MaterialTest.java index 692bb920..66f4603a 100644 --- a/src/test/java/org/bukkit/MaterialTest.java +++ b/src/test/java/org/bukkit/MaterialTest.java @@ -44,6 +44,26 @@ public class MaterialTest { } @Test + public void matchMaterialByKey() { + for (Material material : Material.values()) { + if (material.isLegacy()) { + continue; + } + assertThat(Material.matchMaterial(material.getKey().toString()), is(material)); + } + } + + @Test + public void matchMaterialByWrongNamespace() { + for (Material material : Material.values()) { + if (material.isLegacy()) { + continue; + } + assertNull(Material.matchMaterial("bogus:" + material.getKey().getKey())); + } + } + + @Test public void matchMaterialByLowerCaseAndSpaces() { for (Material material : Material.values()) { String name = material.toString().replaceAll("_", " ").toLowerCase(java.util.Locale.ENGLISH); |