From 3d50da5752316cd9a6de6869d707ef5c247d82c3 Mon Sep 17 00:00:00 2001 From: md_5 Date: Wed, 29 Aug 2018 19:26:58 +1000 Subject: Make matchMaterial accept the minecraft: namespace --- src/test/java/org/bukkit/MaterialTest.java | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/test/java') 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 @@ -43,6 +43,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()) { -- cgit v1.2.3