summaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/org/bukkit/DyeColorsTest.java8
-rw-r--r--src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaImplementationOverrideTest.java57
-rw-r--r--src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java30
-rw-r--r--src/test/java/org/bukkit/craftbukkit/inventory/ItemStackBookTest.java1
-rw-r--r--src/test/java/org/bukkit/craftbukkit/inventory/ItemStackEnchantStorageTest.java108
-rw-r--r--src/test/java/org/bukkit/craftbukkit/inventory/ItemStackFireworkChargeTest.java128
-rw-r--r--src/test/java/org/bukkit/craftbukkit/inventory/ItemStackFireworkTest.java184
-rw-r--r--src/test/java/org/bukkit/craftbukkit/inventory/ItemStackLeatherTest.java1
-rw-r--r--src/test/java/org/bukkit/craftbukkit/inventory/ItemStackLoreEnchantmentTest.java1
-rw-r--r--src/test/java/org/bukkit/craftbukkit/inventory/ItemStackPotionsTest.java1
-rw-r--r--src/test/java/org/bukkit/craftbukkit/inventory/ItemStackSkullTest.java1
-rw-r--r--src/test/java/org/bukkit/craftbukkit/inventory/ItemStackTest.java1
12 files changed, 499 insertions, 22 deletions
diff --git a/src/test/java/org/bukkit/DyeColorsTest.java b/src/test/java/org/bukkit/DyeColorsTest.java
index 296f49a4..8b2e8a7c 100644
--- a/src/test/java/org/bukkit/DyeColorsTest.java
+++ b/src/test/java/org/bukkit/DyeColorsTest.java
@@ -7,6 +7,7 @@ import java.util.ArrayList;
import java.util.List;
import net.minecraft.server.EntitySheep;
+import net.minecraft.server.ItemDye;
import org.bukkit.support.AbstractTestingBase;
import org.junit.Test;
@@ -36,4 +37,11 @@ public class DyeColorsTest extends AbstractTestingBase {
Color nmsColor = Color.fromRGB((int) (nmsColorArray[0] * 255), (int) (nmsColorArray[1] * 255), (int) (nmsColorArray[2] * 255));
assertThat(color, is(nmsColor));
}
+
+ @Test
+ public void checkFireworkColor() {
+ Color color = dye.getFireworkColor();
+ int nmsColor = ItemDye.b[dye.getData()];
+ assertThat(color, is(Color.fromRGB(nmsColor)));
+ }
}
diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaImplementationOverrideTest.java b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaImplementationOverrideTest.java
index ac0702a2..f1b4ec0d 100644
--- a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaImplementationOverrideTest.java
+++ b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaImplementationOverrideTest.java
@@ -1,10 +1,15 @@
package org.bukkit.craftbukkit.inventory;
+import static org.hamcrest.Matchers.*;
+import static org.junit.Assert.*;
+
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
+import java.util.concurrent.Callable;
import org.bukkit.Material;
+import org.bukkit.configuration.serialization.DelegateDeserialization;
import org.bukkit.craftbukkit.Overridden;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -15,14 +20,10 @@ import org.junit.runners.Parameterized.Parameters;
@RunWith(Parameterized.class)
public class ItemMetaImplementationOverrideTest {
static final Class<CraftMetaItem> parent = CraftMetaItem.class;
- static final Class<Overridden> annotation = Overridden.class;
-
- static final List<Object[]> testData = new ArrayList<Object[]>();
- static final Method[] methods;
-
- static final Class<? extends CraftMetaItem>[] subclasses;
- static {
+ @Parameters(name="[{index}]:{1}")
+ public static List<Object[]> data() {
+ final List<Object[]> testData = new ArrayList<Object[]>();
List<Class<? extends CraftMetaItem>> classes = new ArrayList<Class<? extends CraftMetaItem>>();
for (Material material : ItemStackTest.COMPOUND_MATERIALS) {
@@ -31,37 +32,49 @@ public class ItemMetaImplementationOverrideTest {
classes.add(clazz);
}
}
- subclasses = classes.toArray(new Class[0]);
-
List<Method> list = new ArrayList<Method>();
for (Method method: parent.getDeclaredMethods()) {
- if (method.isAnnotationPresent(annotation)) {
+ if (method.isAnnotationPresent(Overridden.class)) {
list.add(method);
}
}
- for (Class<?> clazz : subclasses) {
- for (Method method : list) {
- testData.add(new Object[]{clazz, method, clazz.getSimpleName() + " contains " + method.getName()});
+ for (final Class<?> clazz : classes) {
+ for (final Method method : list) {
+ testData.add(
+ new Object[] {
+ new Callable<Method>() {
+ public Method call() throws Exception {
+ return clazz.getDeclaredMethod(method.getName(), method.getParameterTypes());
+ }
+ },
+ clazz.getSimpleName() + " contains " + method.getName()
+ }
+ );
}
- }
- methods = list.toArray(new Method[list.size()]);
- }
+ testData.add(
+ new Object[] {
+ new Callable<DelegateDeserialization>() {
+ public DelegateDeserialization call() throws Exception {
+ return clazz.getAnnotation(DelegateDeserialization.class);
+ }
+ },
+ clazz.getSimpleName() + " contains annotation " + DelegateDeserialization.class
+ }
+ );
+ }
- @Parameters(name="[{index}]:{2}")
- public static List<Object[]> data() {
return testData;
}
- @Parameter(0) public Class clazz;
- @Parameter(1) public Method method;
- @Parameter(2) public String name;
+ @Parameter(0) public Callable<?> test;
+ @Parameter(1) public String name;
@Test
public void testClass() throws Throwable {
- clazz.getDeclaredMethod(method.getName(), method.getParameterTypes());
+ assertThat(name, test.call(), is(not(nullValue())));
}
}
diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java
index c95f499f..876cefc0 100644
--- a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java
+++ b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java
@@ -7,13 +7,19 @@ import java.util.Arrays;
import java.util.List;
import org.bukkit.Color;
+import org.bukkit.FireworkEffect;
import org.bukkit.Material;
+import org.bukkit.FireworkEffect.Type;
import org.bukkit.craftbukkit.inventory.ItemStackTest.StackProvider;
import org.bukkit.craftbukkit.inventory.ItemStackTest.StackWrapper;
import org.bukkit.craftbukkit.inventory.ItemStackTest.BukkitWrapper;
import org.bukkit.craftbukkit.inventory.ItemStackTest.CraftWrapper;
+import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.BookMeta;
+import org.bukkit.inventory.meta.EnchantmentStorageMeta;
+import org.bukkit.inventory.meta.FireworkEffectMeta;
+import org.bukkit.inventory.meta.FireworkMeta;
import org.bukkit.inventory.meta.LeatherArmorMeta;
import org.bukkit.inventory.meta.MapMeta;
import org.bukkit.inventory.meta.PotionMeta;
@@ -77,6 +83,30 @@ public class ItemMetaTest extends AbstractTestingBase {
cleanStack.setItemMeta(meta);
return cleanStack;
}
+ },
+ new StackProvider(Material.FIREWORK) {
+ @Override ItemStack operate(final ItemStack cleanStack) {
+ final FireworkMeta meta = (FireworkMeta) cleanStack.getItemMeta();
+ meta.addEffect(FireworkEffect.builder().withColor(Color.GREEN).withFade(Color.OLIVE).with(Type.BALL_LARGE).build());
+ cleanStack.setItemMeta(meta);
+ return cleanStack;
+ }
+ },
+ new StackProvider(Material.ENCHANTED_BOOK) {
+ @Override ItemStack operate(final ItemStack cleanStack) {
+ final EnchantmentStorageMeta meta = (EnchantmentStorageMeta) cleanStack.getItemMeta();
+ meta.addStoredEnchant(Enchantment.ARROW_FIRE, 1, true);
+ cleanStack.setItemMeta(meta);
+ return cleanStack;
+ }
+ },
+ new StackProvider(Material.FIREWORK_CHARGE) {
+ @Override ItemStack operate(final ItemStack cleanStack) {
+ final FireworkEffectMeta meta = (FireworkEffectMeta) cleanStack.getItemMeta();
+ meta.setEffect(FireworkEffect.builder().withColor(Color.MAROON, Color.BLACK).with(Type.CREEPER).withFlicker().build());
+ cleanStack.setItemMeta(meta);
+ return cleanStack;
+ }
}
);
diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackBookTest.java b/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackBookTest.java
index 8321eefe..a7edc048 100644
--- a/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackBookTest.java
+++ b/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackBookTest.java
@@ -20,6 +20,7 @@ public class ItemStackBookTest extends ItemStackTest {
return StackProvider.compound(operators(), "%s %s", NAME_PARAMETER, Material.WRITTEN_BOOK, Material.BOOK_AND_QUILL);
}
+ @SuppressWarnings("unchecked")
static List<Object[]> operators() {
return CompoundOperator.compound(
Joiner.on('+'),
diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackEnchantStorageTest.java b/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackEnchantStorageTest.java
new file mode 100644
index 00000000..a0499b8a
--- /dev/null
+++ b/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackEnchantStorageTest.java
@@ -0,0 +1,108 @@
+package org.bukkit.craftbukkit.inventory;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.bukkit.Material;
+import org.bukkit.enchantments.Enchantment;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.inventory.meta.EnchantmentStorageMeta;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+import com.google.common.base.Joiner;
+
+@RunWith(Parameterized.class)
+public class ItemStackEnchantStorageTest extends ItemStackTest {
+
+ @Parameters(name="[{index}]:{" + NAME_PARAMETER + "}")
+ public static List<Object[]> data() {
+ return StackProvider.compound(operators(), "%s %s", NAME_PARAMETER, Material.ENCHANTED_BOOK);
+ }
+
+ @SuppressWarnings("unchecked")
+ static List<Object[]> operators() {
+ return CompoundOperator.compound(
+ Joiner.on('+'),
+ NAME_PARAMETER,
+ Long.parseLong("10", 2),
+ ItemStackLoreEnchantmentTest.operators(),
+ Arrays.asList(
+ new Object[] {
+ new Operator() {
+ public ItemStack operate(ItemStack cleanStack) {
+ EnchantmentStorageMeta meta = (EnchantmentStorageMeta) cleanStack.getItemMeta();
+ meta.addStoredEnchant(Enchantment.DURABILITY, 1, true);
+ cleanStack.setItemMeta(meta);
+ return cleanStack;
+ }
+ },
+ new Operator() {
+ public ItemStack operate(ItemStack cleanStack) {
+ EnchantmentStorageMeta meta = (EnchantmentStorageMeta) cleanStack.getItemMeta();
+ cleanStack.setItemMeta(meta);
+ return cleanStack;
+ }
+ },
+ "Enchantable vs Blank"
+ },
+ new Object[] {
+ new Operator() {
+ public ItemStack operate(ItemStack cleanStack) {
+ EnchantmentStorageMeta meta = (EnchantmentStorageMeta) cleanStack.getItemMeta();
+ meta.addStoredEnchant(Enchantment.KNOCKBACK, 1, true);
+ cleanStack.setItemMeta(meta);
+ return cleanStack;
+ }
+ },
+ new Operator() {
+ public ItemStack operate(ItemStack cleanStack) {
+ return cleanStack;
+ }
+ },
+ "Enchantable vs Null"
+ },
+ new Object[] {
+ new Operator() {
+ public ItemStack operate(ItemStack cleanStack) {
+ EnchantmentStorageMeta meta = (EnchantmentStorageMeta) cleanStack.getItemMeta();
+ meta.addStoredEnchant(Enchantment.DAMAGE_UNDEAD, 1, true);
+ cleanStack.setItemMeta(meta);
+ return cleanStack;
+ }
+ },
+ new Operator() {
+ public ItemStack operate(ItemStack cleanStack) {
+ EnchantmentStorageMeta meta = (EnchantmentStorageMeta) cleanStack.getItemMeta();
+ meta.addStoredEnchant(Enchantment.DAMAGE_UNDEAD, 1, true);
+ meta.addStoredEnchant(Enchantment.FIRE_ASPECT, 1, true);
+ cleanStack.setItemMeta(meta);
+ return cleanStack;
+ }
+ },
+ "Enchantable vs More"
+ },
+ new Object[] {
+ new Operator() {
+ public ItemStack operate(ItemStack cleanStack) {
+ EnchantmentStorageMeta meta = (EnchantmentStorageMeta) cleanStack.getItemMeta();
+ meta.addStoredEnchant(Enchantment.PROTECTION_FIRE, 1, true);
+ cleanStack.setItemMeta(meta);
+ return cleanStack;
+ }
+ },
+ new Operator() {
+ public ItemStack operate(ItemStack cleanStack) {
+ EnchantmentStorageMeta meta = (EnchantmentStorageMeta) cleanStack.getItemMeta();
+ meta.addEnchant(Enchantment.PROTECTION_FIRE, 2, true);
+ cleanStack.setItemMeta(meta);
+ return cleanStack;
+ }
+ },
+ "Enchantable vs Other"
+ }
+ )
+ );
+ }
+}
diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackFireworkChargeTest.java b/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackFireworkChargeTest.java
new file mode 100644
index 00000000..cb38cd27
--- /dev/null
+++ b/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackFireworkChargeTest.java
@@ -0,0 +1,128 @@
+package org.bukkit.craftbukkit.inventory;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.bukkit.Color;
+import org.bukkit.FireworkEffect;
+import org.bukkit.FireworkEffect.Type;
+import org.bukkit.Material;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.inventory.meta.FireworkEffectMeta;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+import com.google.common.base.Joiner;
+
+@RunWith(Parameterized.class)
+public class ItemStackFireworkChargeTest extends ItemStackTest {
+
+ @Parameters(name="[{index}]:{" + NAME_PARAMETER + "}")
+ public static List<Object[]> data() {
+ return StackProvider.compound(operators(), "%s %s", NAME_PARAMETER, Material.FIREWORK_CHARGE);
+ }
+
+ @SuppressWarnings("unchecked")
+ static List<Object[]> operators() {
+ return CompoundOperator.compound(
+ Joiner.on('+'),
+ NAME_PARAMETER,
+ Long.parseLong("10", 2),
+ ItemStackLoreEnchantmentTest.operators(),
+ Arrays.asList(
+ new Object[] {
+ new Operator() {
+ public ItemStack operate(ItemStack cleanStack) {
+ FireworkEffectMeta meta = (FireworkEffectMeta) cleanStack.getItemMeta();
+ meta.setEffect(FireworkEffect.builder().withColor(Color.WHITE).build());
+ cleanStack.setItemMeta(meta);
+ return cleanStack;
+ }
+ },
+ new Operator() {
+ public ItemStack operate(ItemStack cleanStack) {
+ FireworkEffectMeta meta = (FireworkEffectMeta) cleanStack.getItemMeta();
+ meta.setEffect(FireworkEffect.builder().withColor(Color.BLACK).build());
+ cleanStack.setItemMeta(meta);
+ return cleanStack;
+ }
+ },
+ "Effect Color 1 vs. Effect Color 2"
+ },
+ new Object[] {
+ new Operator() {
+ public ItemStack operate(ItemStack cleanStack) {
+ FireworkEffectMeta meta = (FireworkEffectMeta) cleanStack.getItemMeta();
+ meta.setEffect(FireworkEffect.builder().withColor(Color.WHITE).with(Type.CREEPER).build());
+ cleanStack.setItemMeta(meta);
+ return cleanStack;
+ }
+ },
+ new Operator() {
+ public ItemStack operate(ItemStack cleanStack) {
+ FireworkEffectMeta meta = (FireworkEffectMeta) cleanStack.getItemMeta();
+ meta.setEffect(FireworkEffect.builder().withColor(Color.WHITE).with(Type.BURST).build());
+ cleanStack.setItemMeta(meta);
+ return cleanStack;
+ }
+ },
+ "Effect type 1 vs. Effect type 2"
+ },
+ new Object[] {
+ new Operator() {
+ public ItemStack operate(ItemStack cleanStack) {
+ FireworkEffectMeta meta = (FireworkEffectMeta) cleanStack.getItemMeta();
+ meta.setEffect(FireworkEffect.builder().withColor(Color.WHITE).withFade(Color.BLUE).build());
+ cleanStack.setItemMeta(meta);
+ return cleanStack;
+ }
+ },
+ new Operator() {
+ public ItemStack operate(ItemStack cleanStack) {
+ FireworkEffectMeta meta = (FireworkEffectMeta) cleanStack.getItemMeta();
+ meta.setEffect(FireworkEffect.builder().withColor(Color.WHITE).withFade(Color.RED).build());
+ cleanStack.setItemMeta(meta);
+ return cleanStack;
+ }
+ },
+ "Effect fade 1 vs. Effect fade 2"
+ },
+ new Object[] {
+ new Operator() {
+ public ItemStack operate(ItemStack cleanStack) {
+ FireworkEffectMeta meta = (FireworkEffectMeta) cleanStack.getItemMeta();
+ meta.setEffect(FireworkEffect.builder().withColor(Color.WHITE).withFlicker().build());
+ cleanStack.setItemMeta(meta);
+ return cleanStack;
+ }
+ },
+ new Operator() {
+ public ItemStack operate(ItemStack cleanStack) {
+ FireworkEffectMeta meta = (FireworkEffectMeta) cleanStack.getItemMeta();
+ cleanStack.setItemMeta(meta);
+ return cleanStack;
+ }
+ },
+ "Effect vs. Null"
+ },
+ new Object[] {
+ new Operator() {
+ public ItemStack operate(ItemStack cleanStack) {
+ FireworkEffectMeta meta = (FireworkEffectMeta) cleanStack.getItemMeta();
+ meta.setEffect(FireworkEffect.builder().withColor(Color.WHITE).withTrail().build());
+ cleanStack.setItemMeta(meta);
+ return cleanStack;
+ }
+ },
+ new Operator() {
+ public ItemStack operate(ItemStack cleanStack) {
+ return cleanStack;
+ }
+ },
+ "Effect vs. None"
+ }
+ )
+ );
+ }
+}
diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackFireworkTest.java b/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackFireworkTest.java
new file mode 100644
index 00000000..afacf3b7
--- /dev/null
+++ b/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackFireworkTest.java
@@ -0,0 +1,184 @@
+package org.bukkit.craftbukkit.inventory;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.bukkit.Color;
+import org.bukkit.FireworkEffect;
+import org.bukkit.Material;
+import org.bukkit.FireworkEffect.Type;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.inventory.meta.FireworkMeta;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+import com.google.common.base.Joiner;
+
+@RunWith(Parameterized.class)
+public class ItemStackFireworkTest extends ItemStackTest {
+
+ @Parameters(name="[{index}]:{" + NAME_PARAMETER + "}")
+ public static List<Object[]> data() {
+ return StackProvider.compound(operators(), "%s %s", NAME_PARAMETER, Material.FIREWORK);
+ }
+
+ @SuppressWarnings("unchecked")
+ static List<Object[]> operators() {
+ return CompoundOperator.compound(
+ Joiner.on('+'),
+ NAME_PARAMETER,
+ Long.parseLong("110", 2),
+ ItemStackLoreEnchantmentTest.operators(),
+ Arrays.asList(
+ new Object[] {
+ new Operator() {
+ public ItemStack operate(ItemStack cleanStack) {
+ FireworkMeta meta = (FireworkMeta) cleanStack.getItemMeta();
+ meta.addEffect(FireworkEffect.builder().withColor(Color.WHITE).build());
+ cleanStack.setItemMeta(meta);
+ return cleanStack;
+ }
+ },
+ new Operator() {
+ public ItemStack operate(ItemStack cleanStack) {
+ FireworkMeta meta = (FireworkMeta) cleanStack.getItemMeta();
+ meta.addEffect(FireworkEffect.builder().withColor(Color.BLACK).build());
+ meta.addEffect(FireworkEffect.builder().withColor(Color.GREEN).build());
+ cleanStack.setItemMeta(meta);
+ return cleanStack;
+ }
+ },
+ "Effect Color 1 vs. Effect Color 2"
+ },
+ new Object[] {
+ new Operator() {
+ public ItemStack operate(ItemStack cleanStack) {
+ FireworkMeta meta = (FireworkMeta) cleanStack.getItemMeta();
+ meta.addEffect(FireworkEffect.builder().withColor(Color.WHITE).with(Type.CREEPER).build());
+ cleanStack.setItemMeta(meta);
+ return cleanStack;
+ }
+ },
+ new Operator() {
+ public ItemStack operate(ItemStack cleanStack) {
+ FireworkMeta meta = (FireworkMeta) cleanStack.getItemMeta();
+ meta.addEffect(FireworkEffect.builder().withColor(Color.WHITE).with(Type.BURST).build());
+ cleanStack.setItemMeta(meta);
+ return cleanStack;
+ }
+ },
+ "Effect type 1 vs. Effect type 2"
+ },
+ new Object[] {
+ new Operator() {
+ public ItemStack operate(ItemStack cleanStack) {
+ FireworkMeta meta = (FireworkMeta) cleanStack.getItemMeta();
+ meta.addEffect(FireworkEffect.builder().withColor(Color.WHITE).withFade(Color.BLUE).build());
+ cleanStack.setItemMeta(meta);
+ return cleanStack;
+ }
+ },
+ new Operator() {
+ public ItemStack operate(ItemStack cleanStack) {
+ FireworkMeta meta = (FireworkMeta) cleanStack.getItemMeta();
+ meta.addEffect(FireworkEffect.builder().withColor(Color.WHITE).withFade(Color.RED).build());
+ cleanStack.setItemMeta(meta);
+ return cleanStack;
+ }
+ },
+ "Effect fade 1 vs. Effect fade 2"
+ },
+ new Object[] {
+ new Operator() {
+ public ItemStack operate(ItemStack cleanStack) {
+ FireworkMeta meta = (FireworkMeta) cleanStack.getItemMeta();
+ meta.addEffect(FireworkEffect.builder().withColor(Color.WHITE).withFlicker().build());
+ cleanStack.setItemMeta(meta);
+ return cleanStack;
+ }
+ },
+ new Operator() {
+ public ItemStack operate(ItemStack cleanStack) {
+ FireworkMeta meta = (FireworkMeta) cleanStack.getItemMeta();
+ cleanStack.setItemMeta(meta);
+ return cleanStack;
+ }
+ },
+ "Effect vs. Null"
+ },
+ new Object[] {
+ new Operator() {
+ public ItemStack operate(ItemStack cleanStack) {
+ FireworkMeta meta = (FireworkMeta) cleanStack.getItemMeta();
+ meta.addEffect(FireworkEffect.builder().withColor(Color.WHITE).withTrail().build());
+ cleanStack.setItemMeta(meta);
+ return cleanStack;
+ }
+ },
+ new Operator() {
+ public ItemStack operate(ItemStack cleanStack) {
+ return cleanStack;
+ }
+ },
+ "Effect vs. None"
+ }
+ ),
+ Arrays.asList(
+ new Object[] {
+ new Operator() {
+ public ItemStack operate(ItemStack cleanStack) {
+ FireworkMeta meta = (FireworkMeta) cleanStack.getItemMeta();
+ meta.setPower(150);
+ cleanStack.setItemMeta(meta);
+ return cleanStack;
+ }
+ },
+ new Operator() {
+ public ItemStack operate(ItemStack cleanStack) {
+ FireworkMeta meta = (FireworkMeta) cleanStack.getItemMeta();
+ meta.setPower(100);
+ cleanStack.setItemMeta(meta);
+ return cleanStack;
+ }
+ },
+ "Height vs. Other"
+ },
+ new Object[] {
+ new Operator() {
+ public ItemStack operate(ItemStack cleanStack) {
+ FireworkMeta meta = (FireworkMeta) cleanStack.getItemMeta();
+ meta.setPower(200);
+ cleanStack.setItemMeta(meta);
+ return cleanStack;
+ }
+ },
+ new Operator() {
+ public ItemStack operate(ItemStack cleanStack) {
+ FireworkMeta meta = (FireworkMeta) cleanStack.getItemMeta();
+ cleanStack.setItemMeta(meta);
+ return cleanStack;
+ }
+ },
+ "Height vs. Null"
+ },
+ new Object[] {
+ new Operator() {
+ public ItemStack operate(ItemStack cleanStack) {
+ FireworkMeta meta = (FireworkMeta) cleanStack.getItemMeta();
+ meta.setPower(10);
+ cleanStack.setItemMeta(meta);
+ return cleanStack;
+ }
+ },
+ new Operator() {
+ public ItemStack operate(ItemStack cleanStack) {
+ return cleanStack;
+ }
+ },
+ "Height vs. None"
+ }
+ )
+ );
+ }
+}
diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackLeatherTest.java b/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackLeatherTest.java
index a6f95831..6d68e1f4 100644
--- a/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackLeatherTest.java
+++ b/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackLeatherTest.java
@@ -22,6 +22,7 @@ public class ItemStackLeatherTest extends ItemStackTest {
return StackProvider.compound(operators(), "%s %s", NAME_PARAMETER, Material.LEATHER_BOOTS, Material.LEATHER_CHESTPLATE, Material.LEATHER_HELMET, Material.LEATHER_LEGGINGS);
}
+ @SuppressWarnings("unchecked")
static List<Object[]> operators() {
return CompoundOperator.compound(
Joiner.on('+'),
diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackLoreEnchantmentTest.java b/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackLoreEnchantmentTest.java
index d3604fbc..7de61aaa 100644
--- a/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackLoreEnchantmentTest.java
+++ b/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackLoreEnchantmentTest.java
@@ -20,6 +20,7 @@ public class ItemStackLoreEnchantmentTest extends ItemStackTest {
return StackProvider.compound(operators(), "%s %s", NAME_PARAMETER, ItemStackTest.COMPOUND_MATERIALS);
}
+ @SuppressWarnings("unchecked")
static List<Object[]> operators() {
return CompoundOperator.compound(
Joiner.on('+'),
diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackPotionsTest.java b/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackPotionsTest.java
index e6aa2c46..c1f9fb74 100644
--- a/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackPotionsTest.java
+++ b/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackPotionsTest.java
@@ -21,6 +21,7 @@ public class ItemStackPotionsTest extends ItemStackTest {
return StackProvider.compound(operators(), "%s %s", NAME_PARAMETER, Material.POTION);
}
+ @SuppressWarnings("unchecked")
static List<Object[]> operators() {
return CompoundOperator.compound(
Joiner.on('+'),
diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackSkullTest.java b/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackSkullTest.java
index ea6381fa..a79d443e 100644
--- a/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackSkullTest.java
+++ b/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackSkullTest.java
@@ -20,6 +20,7 @@ public class ItemStackSkullTest extends ItemStackTest {
return StackProvider.compound(operators(), "%s %s", NAME_PARAMETER, Material.SKULL_ITEM);
}
+ @SuppressWarnings("unchecked")
static List<Object[]> operators() {
return CompoundOperator.compound(
Joiner.on('+'),
diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackTest.java b/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackTest.java
index 4592e1dc..5d174e20 100644
--- a/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackTest.java
+++ b/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackTest.java
@@ -184,6 +184,7 @@ public class ItemStackTest extends AbstractTestingBase {
out.addAll(primarySingleton);
}
+ @SuppressWarnings("unchecked")
final List<Object[]>[] lists = new List[notSingletons.size() + 1];
notSingletons.toArray(lists);
lists[lists.length - 1] = out;