mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-04 22:22:18 -07:00
SPIGOT-2892: Fix some clone implementations and add unit test
This commit is contained in:
@@ -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)));
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user