[Bleeding] Added Enchantment and misc tests to ItemStack (de)serialization

This commit is contained in:
Wesley Wolfe
2012-02-16 14:37:57 -06:00
committed by EvilSeph
parent 2131f6966e
commit fa31bf889c
2 changed files with 76 additions and 0 deletions

View File

@@ -4,12 +4,17 @@ import java.util.ArrayList;
import java.util.List;
import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.ItemStack;
import org.junit.Test;
import static org.junit.Assert.*;
public class YamlConfigurationTest extends FileConfigurationTest {
static {
TestEnchantment.registerEnchantments();
}
@Override
public YamlConfiguration getConfig() {
return new YamlConfiguration();
@@ -67,6 +72,21 @@ public class YamlConfigurationTest extends FileConfigurationTest {
stacks.add(new ItemStack(1));
stacks.add(new ItemStack(2));
stacks.add(new ItemStack(3));
stacks.add(new ItemStack(4, 17));
stacks.add(new ItemStack(5, 63));
stacks.add(new ItemStack(6, 1, (short) 1));
stacks.add(new ItemStack(18, 32, (short) 2));
ItemStack item7 = new ItemStack(256);
item7.addEnchantment(Enchantment.getById(1), 1);
stacks.add(item7);
ItemStack item8 = new ItemStack(257);
item8.addEnchantment(Enchantment.getById(2), 2);
item8.addEnchantment(Enchantment.getById(3), 1);
item8.addEnchantment(Enchantment.getById(4), 5);
item8.addEnchantment(Enchantment.getById(5), 4);
stacks.add(item8);
out.set("composite-list.abc.def", stacks);
String yaml = out.saveToString();
@@ -79,5 +99,11 @@ public class YamlConfigurationTest extends FileConfigurationTest {
assertEquals(stacks.get(0), raw.get(0));
assertEquals(stacks.get(1), raw.get(1));
assertEquals(stacks.get(2), raw.get(2));
assertEquals(stacks.get(3), raw.get(3));
assertEquals(stacks.get(4), raw.get(4));
assertEquals(stacks.get(5), raw.get(5));
assertEquals(stacks.get(6), raw.get(6));
assertEquals(stacks.get(7), raw.get(7));
assertEquals(stacks.get(8), raw.get(8));
}
}