diff options
author | Andrew Ardill <andrew.ardill@gmail.com> | 2011-12-20 00:25:15 +1100 |
---|---|---|
committer | Andrew Ardill <andrew.ardill@gmail.com> | 2011-12-20 00:25:15 +1100 |
commit | acfb4f2fbe00bf103c2779cfa7d970ebdeb48fa3 (patch) | |
tree | a2dbed5535c6f22e85f71d2841b0b83a5b3a5dd2 /src/test/java/org/bukkit | |
parent | 18437f681952e217cc2a3bf9ebfca87b51c81f04 (diff) | |
download | craftbukkit-acfb4f2fbe00bf103c2779cfa7d970ebdeb48fa3.tar craftbukkit-acfb4f2fbe00bf103c2779cfa7d970ebdeb48fa3.tar.gz craftbukkit-acfb4f2fbe00bf103c2779cfa7d970ebdeb48fa3.tar.lz craftbukkit-acfb4f2fbe00bf103c2779cfa7d970ebdeb48fa3.tar.xz craftbukkit-acfb4f2fbe00bf103c2779cfa7d970ebdeb48fa3.zip |
Test cloning enchanted CraftItemStacks
Diffstat (limited to 'src/test/java/org/bukkit')
-rw-r--r-- | src/test/java/org/bukkit/craftbukkit/inventory/CraftItemStackTest.java | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/CraftItemStackTest.java b/src/test/java/org/bukkit/craftbukkit/inventory/CraftItemStackTest.java new file mode 100644 index 00000000..28ad98a5 --- /dev/null +++ b/src/test/java/org/bukkit/craftbukkit/inventory/CraftItemStackTest.java @@ -0,0 +1,28 @@ +package org.bukkit.craftbukkit.inventory; + +import net.minecraft.server.Enchantment; +import net.minecraft.server.StatisticList; +import org.bukkit.inventory.ItemStack; +import org.junit.Before; +import org.junit.Test; + +public class CraftItemStackTest { + @Before + public void setUp() throws Exception { + StatisticList.a(); + } + + @Test + public void testCloneEnchantedItem() throws Exception { + net.minecraft.server.ItemStack nmsItemStack = new net.minecraft.server.ItemStack(net.minecraft.server.Item.POTION); + nmsItemStack.addEnchantment(Enchantment.DAMAGE_ALL, 1); + ItemStack itemStack = new CraftItemStack(nmsItemStack); + ItemStack clone = itemStack.clone(); + assert (clone.getType().equals(itemStack.getType())); + assert (clone.getAmount() == itemStack.getAmount()); + assert (clone.getDurability() == itemStack.getDurability()); + assert (clone.getEnchantments().equals(itemStack.getEnchantments())); + assert (clone.getTypeId() == itemStack.getTypeId()); + assert (clone.getData().equals(itemStack.getData())); + } +} |