diff options
author | md_5 <git@md-5.net> | 2017-12-16 10:18:34 +1100 |
---|---|---|
committer | md_5 <git@md-5.net> | 2017-12-16 10:18:34 +1100 |
commit | fb4564cc37c37a19a8920025de6bb19dbf852338 (patch) | |
tree | 9049e08b31667f3df5ba7c5ebadd2496b9a73f06 /src/test | |
parent | 2ee49b4955aaab9f3827db8771da59b2b403ad9a (diff) | |
download | craftbukkit-fb4564cc37c37a19a8920025de6bb19dbf852338.tar craftbukkit-fb4564cc37c37a19a8920025de6bb19dbf852338.tar.gz craftbukkit-fb4564cc37c37a19a8920025de6bb19dbf852338.tar.lz craftbukkit-fb4564cc37c37a19a8920025de6bb19dbf852338.tar.xz craftbukkit-fb4564cc37c37a19a8920025de6bb19dbf852338.zip |
SPIGOT-2892: Fix some clone implementations and add unit test
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaCloneTest.java | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaCloneTest.java b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaCloneTest.java new file mode 100644 index 00000000..834fb297 --- /dev/null +++ b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaCloneTest.java @@ -0,0 +1,22 @@ +package org.bukkit.craftbukkit.inventory; + +import java.lang.reflect.Method; +import org.bukkit.Material; +import org.junit.Test; + +import static org.hamcrest.Matchers.*; +import static org.junit.Assert.*; + +public class ItemMetaCloneTest { + + @Test + public void testClone() throws Throwable { + for (Material material : ItemStackTest.COMPOUND_MATERIALS) { + Class<?> clazz = CraftItemFactory.instance().getItemMeta(material).getClass(); + + Method clone = clazz.getDeclaredMethod("clone"); + assertNotNull("Class " + clazz + " does not override clone()", clone); + assertThat("Class " + clazz + " clone return type does not match", clone.getReturnType(), is(equalTo(clazz))); + } + } +} |