Reimplement a bunch more tests

This commit is contained in:
Dan Mulloy 2015-04-06 17:30:01 -04:00
parent 0958c042c9
commit a2c9240011
8 changed files with 176 additions and 63 deletions

View File

@ -394,6 +394,22 @@ public class FieldUtils {
writeStaticField(field, value); writeStaticField(field, value);
} }
public static void writeStaticFinalField(Class<?> clazz, String fieldName, Object value, boolean forceAccess) throws Exception {
Field field = getField(clazz, fieldName, forceAccess);
if (field == null) {
throw new IllegalArgumentException("Cannot locate field " + fieldName + " in " + clazz);
}
field.setAccessible(true);
Field modifiersField = Field.class.getDeclaredField("modifiers");
modifiersField.setAccessible(true);
modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL);
field.setAccessible(true);
field.set(null, value);
}
/** /**
* Write an accessible field. * Write an accessible field.
* *

View File

@ -726,6 +726,7 @@ public class BukkitConverters {
requireModifier(Modifier.STATIC). requireModifier(Modifier.STATIC).
build(); build();
FuzzyMethodContract getBlockContract = FuzzyMethodContract.newBuilder(). FuzzyMethodContract getBlockContract = FuzzyMethodContract.newBuilder().
returnTypeExact(block).
parameterExactArray(int.class). parameterExactArray(int.class).
requireModifier(Modifier.STATIC). requireModifier(Modifier.STATIC).
build(); build();

View File

@ -1,8 +1,19 @@
package com.comphenix.protocol; package com.comphenix.protocol;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import net.minecraft.server.v1_8_R2.DispenserRegistry;
import org.bukkit.Bukkit;
import org.bukkit.Server;
import org.bukkit.inventory.ItemFactory;
import org.bukkit.inventory.meta.ItemMeta;
import com.comphenix.protocol.reflect.FieldUtils;
import com.comphenix.protocol.utility.Constants; import com.comphenix.protocol.utility.Constants;
import com.comphenix.protocol.utility.MinecraftReflection; import com.comphenix.protocol.utility.MinecraftReflection;
import com.comphenix.protocol.utility.MinecraftVersion; import com.comphenix.protocol.utility.MinecraftVersion;
import com.comphenix.protocol.wrappers.ItemFactoryDelegate;
/** /**
* Used to ensure that ProtocolLib and Bukkit is prepared to be tested. * Used to ensure that ProtocolLib and Bukkit is prepared to be tested.
@ -10,55 +21,43 @@ import com.comphenix.protocol.utility.MinecraftVersion;
* @author Kristian * @author Kristian
*/ */
public class BukkitInitialization { public class BukkitInitialization {
// private static boolean initialized; private static boolean initialized;
/** /**
* Initialize Bukkit and ProtocolLib such that we can perfrom unit testing. * Initialize Bukkit and ProtocolLib such that we can perfrom unit testing.
* @throws IllegalAccessException If we are unable to initialize Bukkit. * @throws IllegalAccessException If we are unable to initialize Bukkit.
*/ */
public static void initializeItemMeta() throws IllegalAccessException { public static void initializeItemMeta() throws IllegalAccessException {
/* None of this works in 1.8 // None of this works in 1.8
if (!initialized) { if (!initialized) {
// Denote that we're done // Denote that we're done
initialized = true; initialized = true;
initializePackage(); initializePackage();
// "Accessed X before bootstrap! DispenserRegistry.c(); // Basically registers everything
try {
Block.S(); // Block.register()
} catch (Throwable ex) {
System.err.println("Failed to register blocks: " + ex);
}
try {
Item.t(); // Item.register()
} catch (Throwable ex) {
System.err.println("Failed to register items: " + ex);
}
try {
StatisticList.a(); // StatisticList.register()
} catch (Throwable ex) {
System.err.println("Failed to register statistics: " + ex);
}
// Mock the server object // Mock the server object
Server mockedServer = mock(Server.class); Server mockedServer = mock(Server.class);
ItemFactory mockedFactory = mock(CraftItemFactory.class);
ItemMeta mockedMeta = mock(ItemMeta.class); ItemMeta mockedMeta = mock(ItemMeta.class);
ItemFactory mockedFactory = new ItemFactoryDelegate(mockedMeta);
when(mockedServer.getItemFactory()).thenReturn(mockedFactory); when(mockedServer.getItemFactory()).thenReturn(mockedFactory);
when(mockedServer.isPrimaryThread()).thenReturn(true); when(mockedServer.isPrimaryThread()).thenReturn(true);
when(mockedFactory.getItemMeta(any(Material.class))).thenReturn(mockedMeta); // when(mockedFactory.getItemMeta(any(Material.class))).thenReturn(mockedMeta);
// Inject this fake server // Inject this fake server
FieldUtils.writeStaticField(Bukkit.class, "server", mockedServer, true); FieldUtils.writeStaticField(Bukkit.class, "server", mockedServer, true);
// And the fake item factory // TODO Figure this out
FieldUtils.writeStaticField(CraftItemFactory.class, "instance", mockedFactory, true); /* try {
FieldUtils.writeStaticFinalField(CraftItemFactory.class, "instance", mockedFactory, true);
} catch (Exception ex) {
System.err.println("Failed to inject fake item factory: ");
ex.printStackTrace();
} */ } */
} }
}
/** /**
* Ensure that package names are correctly set up. * Ensure that package names are correctly set up.

View File

@ -18,14 +18,20 @@ package com.comphenix.protocol.events;
import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull; import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.lang.reflect.Array;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
import org.apache.commons.lang.SerializationUtils; import org.apache.commons.lang.SerializationUtils;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.WorldType; import org.bukkit.WorldType;
import org.bukkit.inventory.ItemStack;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
@ -34,12 +40,18 @@ import org.powermock.core.classloader.annotations.PowerMockIgnore;
import com.comphenix.protocol.BukkitInitialization; import com.comphenix.protocol.BukkitInitialization;
import com.comphenix.protocol.PacketType; import com.comphenix.protocol.PacketType;
import com.comphenix.protocol.PacketType.Sender; import com.comphenix.protocol.PacketType.Sender;
import com.comphenix.protocol.reflect.EquivalentConverter;
import com.comphenix.protocol.reflect.StructureModifier; import com.comphenix.protocol.reflect.StructureModifier;
import com.comphenix.protocol.utility.MinecraftReflection; import com.comphenix.protocol.utility.MinecraftReflection;
import com.comphenix.protocol.utility.Util;
import com.comphenix.protocol.wrappers.BukkitConverters;
import com.comphenix.protocol.wrappers.WrappedChatComponent; import com.comphenix.protocol.wrappers.WrappedChatComponent;
import com.comphenix.protocol.wrappers.WrappedDataWatcher; import com.comphenix.protocol.wrappers.WrappedDataWatcher;
import com.comphenix.protocol.wrappers.WrappedGameProfile; import com.comphenix.protocol.wrappers.WrappedGameProfile;
import com.comphenix.protocol.wrappers.WrappedWatchableObject; import com.comphenix.protocol.wrappers.WrappedWatchableObject;
import com.comphenix.protocol.wrappers.nbt.NbtCompound;
import com.comphenix.protocol.wrappers.nbt.NbtFactory;
import com.google.common.base.Objects;
// Ensure that the CraftItemFactory is mockable // Ensure that the CraftItemFactory is mockable
@RunWith(org.powermock.modules.junit4.PowerMockRunner.class) @RunWith(org.powermock.modules.junit4.PowerMockRunner.class)
@ -47,8 +59,8 @@ import com.comphenix.protocol.wrappers.WrappedWatchableObject;
//@PrepareForTest(CraftItemFactory.class) //@PrepareForTest(CraftItemFactory.class)
public class PacketContainerTest { public class PacketContainerTest {
// Helper converters // Helper converters
// private EquivalentConverter<WrappedDataWatcher> watchConvert = BukkitConverters.getDataWatcherConverter(); private EquivalentConverter<WrappedDataWatcher> watchConvert = BukkitConverters.getDataWatcherConverter();
// private EquivalentConverter<ItemStack> itemConvert = BukkitConverters.getItemStackConverter(); private EquivalentConverter<ItemStack> itemConvert = BukkitConverters.getItemStackConverter();
@BeforeClass @BeforeClass
public static void initializeBukkit() throws IllegalAccessException { public static void initializeBukkit() throws IllegalAccessException {
@ -139,6 +151,7 @@ public class PacketContainerTest {
testPrimitive(explosion.getStrings(), 0, null, "hello"); testPrimitive(explosion.getStrings(), 0, null, "hello");
} }
// TODO Rewrite with chat components
/* @Test /* @Test
public void testGetStringArrays() { public void testGetStringArrays() {
PacketContainer explosion = new PacketContainer(PacketType.Play.Server.UPDATE_SIGN); PacketContainer explosion = new PacketContainer(PacketType.Play.Server.UPDATE_SIGN);
@ -161,7 +174,7 @@ public class PacketContainerTest {
assertArrayEquals(testArray, integers.read(0)); assertArrayEquals(testArray, integers.read(0));
} }
/* @Test @Test
public void testGetItemModifier() { public void testGetItemModifier() {
PacketContainer windowClick = new PacketContainer(PacketType.Play.Client.WINDOW_CLICK); PacketContainer windowClick = new PacketContainer(PacketType.Play.Client.WINDOW_CLICK);
@ -174,9 +187,9 @@ public class PacketContainerTest {
// Insert the goldaxe and check if it's there // Insert the goldaxe and check if it's there
items.write(0, goldAxe); items.write(0, goldAxe);
assertTrue("Item " + goldAxe + " != " + items.read(0), equivalentItem(goldAxe, items.read(0))); assertTrue("Item " + goldAxe + " != " + items.read(0), equivalentItem(goldAxe, items.read(0)));
} */ }
/* @Test @Test
public void testGetItemArrayModifier() { public void testGetItemArrayModifier() {
PacketContainer windowItems = new PacketContainer(PacketType.Play.Server.WINDOW_ITEMS); PacketContainer windowItems = new PacketContainer(PacketType.Play.Server.WINDOW_ITEMS);
StructureModifier<ItemStack[]> itemAccess = windowItems.getItemArrayModifier(); StructureModifier<ItemStack[]> itemAccess = windowItems.getItemArrayModifier();
@ -197,13 +210,10 @@ public class PacketContainerTest {
// Check that it is equivalent // Check that it is equivalent
for (int i = 0; i < itemArray.length; i++) { for (int i = 0; i < itemArray.length; i++) {
System.out.println(i); ItemStack original = itemArray[i];
ItemStack element = itemArray[i]; ItemStack written = comparison[i];
System.out.println(element);
ItemStack original = comparison[i];
System.out.println(original);
assertTrue(String.format("Array element %s is not the same: %s != %s", i, element, original), equivalentItem(element, original)); assertTrue(String.format("Array element %s is not the same: %s != %s", i, original, written), equivalentItem(original, written));
} }
} }
@ -215,7 +225,7 @@ public class PacketContainerTest {
} else { } else {
return first.getType().equals(second.getType()); return first.getType().equals(second.getType());
} }
} */ }
@Test @Test
public void testGetWorldTypeModifier() { public void testGetWorldTypeModifier() {
@ -235,7 +245,7 @@ public class PacketContainerTest {
assertEquals(testValue, worldAccess.read(0)); assertEquals(testValue, worldAccess.read(0));
} }
/* @Test @Test
public void testGetNbtModifier() { public void testGetNbtModifier() {
PacketContainer updateTileEntity = new PacketContainer(PacketType.Play.Server.TILE_ENTITY_DATA); PacketContainer updateTileEntity = new PacketContainer(PacketType.Play.Server.TILE_ENTITY_DATA);
@ -249,7 +259,7 @@ public class PacketContainerTest {
assertEquals(compound.getString("test"), result.getString("test")); assertEquals(compound.getString("test"), result.getString("test"));
assertEquals(compound.getList("ages"), result.getList("ages")); assertEquals(compound.getList("ages"), result.getList("ages"));
} */ }
@Test @Test
public void testGetDataWatcherModifier() { public void testGetDataWatcherModifier() {
@ -345,6 +355,7 @@ public class PacketContainerTest {
assertEquals("Test", copy.getStrings().read(0)); assertEquals("Test", copy.getStrings().read(0));
} }
// TODO Deal with inner classes
/* @Test /* @Test
public void testAttributeList() { public void testAttributeList() {
PacketContainer attribute = new PacketContainer(PacketType.Play.Server.UPDATE_ATTRIBUTES); PacketContainer attribute = new PacketContainer(PacketType.Play.Server.UPDATE_ATTRIBUTES);
@ -361,6 +372,7 @@ public class PacketContainerTest {
public AttributeSnapshot attributeSnapshot(String string, double d, Collection<AttributeModifier> coll) { public AttributeSnapshot attributeSnapshot(String string, double d, Collection<AttributeModifier> coll) {
return new AttributeSnapshot(string, d, coll); return new AttributeSnapshot(string, d, coll);
} }
}; };
AttributeSnapshot snapshot = new PacketAccessor().attributeSnapshot("generic.Maxhealth", 20.0, modifiers); AttributeSnapshot snapshot = new PacketAccessor().attributeSnapshot("generic.Maxhealth", 20.0, modifiers);
@ -372,7 +384,7 @@ public class PacketContainerTest {
assertEquals( assertEquals(
ToStringBuilder.reflectionToString(snapshot, ToStringStyle.SHORT_PREFIX_STYLE), ToStringBuilder.reflectionToString(snapshot, ToStringStyle.SHORT_PREFIX_STYLE),
ToStringBuilder.reflectionToString(clonedSnapshot, ToStringStyle.SHORT_PREFIX_STYLE)); ToStringBuilder.reflectionToString(clonedSnapshot, ToStringStyle.SHORT_PREFIX_STYLE));
} } */
@Test @Test
public void testBlocks() { public void testBlocks() {
@ -380,8 +392,9 @@ public class PacketContainerTest {
blockAction.getBlocks().write(0, Material.STONE); blockAction.getBlocks().write(0, Material.STONE);
assertEquals(Material.STONE, blockAction.getBlocks().read(0)); assertEquals(Material.STONE, blockAction.getBlocks().read(0));
} */ }
// TODO Rewrite with MobEffects
/* @Test /* @Test
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public void testPotionEffect() { public void testPotionEffect() {
@ -398,13 +411,15 @@ public class PacketContainerTest {
assertEquals(effect.getDuration(), (short) packet.getShorts().read(0)); assertEquals(effect.getDuration(), (short) packet.getShorts().read(0));
} */ } */
/* Fails due to weird logger configuration stuff private static final List<PacketType> BLACKLISTED = Util.asList(
PacketType.Play.Client.CUSTOM_PAYLOAD, PacketType.Play.Server.CUSTOM_PAYLOAD, PacketType.Play.Server.MAP_CHUNK
);
@Test @Test
public void testDeepClone() { public void testDeepClone() {
// Try constructing all the packets // Try constructing all the packets
for (PacketType type : PacketType.values()) { for (PacketType type : PacketType.values()) {
if (type == PacketType.Play.Client.CUSTOM_PAYLOAD) { if (BLACKLISTED.contains(type)) {
// TODO Handle data serializers
continue; continue;
} }
@ -452,7 +467,7 @@ public class PacketContainerTest {
throw new RuntimeException("Failed to serialize packet " + type, e); throw new RuntimeException("Failed to serialize packet " + type, e);
} }
} }
} */ }
@Test @Test
public void testPacketType() { public void testPacketType() {
@ -460,7 +475,7 @@ public class PacketContainerTest {
} }
// Convert to objects that support equals() // Convert to objects that support equals()
/* private void testEquality(Object a, Object b) { private void testEquality(Object a, Object b) {
if (a != null && b != null) { if (a != null && b != null) {
if (MinecraftReflection.isDataWatcher(a)) { if (MinecraftReflection.isDataWatcher(a)) {
a = watchConvert.getSpecific(a); a = watchConvert.getSpecific(a);
@ -482,14 +497,14 @@ public class PacketContainerTest {
} }
assertEquals(a, b); assertEquals(a, b);
} */ }
/** /**
* Get the underlying array as an object array. * Get the underlying array as an object array.
* @param val - array wrapped as an Object. * @param val - array wrapped as an Object.
* @return An object array. * @return An object array.
*/ */
/* private Object[] getArray(Object val) { private Object[] getArray(Object val) {
if (val instanceof Object[]) if (val instanceof Object[])
return (Object[]) val; return (Object[]) val;
if (val == null) if (val == null)
@ -501,5 +516,5 @@ public class PacketContainerTest {
for (int i = 0; i < arrlength; ++i) for (int i = 0; i < arrlength; ++i)
outputArray[i] = Array.get(val, i); outputArray[i] = Array.get(val, i);
return outputArray; return outputArray;
} */ }
} }

View File

@ -5,7 +5,11 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times; import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
import net.minecraft.server.v1_8_R2.ChatComponentText; import net.minecraft.server.v1_8_R2.ChatComponentText;
import net.minecraft.server.v1_8_R2.ChunkCoordIntPair;
import net.minecraft.server.v1_8_R2.IChatBaseComponent; import net.minecraft.server.v1_8_R2.IChatBaseComponent;
import net.minecraft.server.v1_8_R2.ServerPing;
import net.minecraft.server.v1_8_R2.ServerPing.ServerData;
import net.minecraft.server.v1_8_R2.ServerPing.ServerPingPlayerSample;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
@ -78,7 +82,7 @@ public class MinecraftReflectionTest {
/* @Test /* @Test
public void testChatSerializer() { public void testChatSerializer() {
assertEquals(ChatSerializer.class, MinecraftReflection.getChatSerializerClass()); assertEquals(ChatSerializer.class, MinecraftReflection.getChatSerializerClass());
} } */
@Test @Test
public void testServerPing() { public void testServerPing() {
@ -100,7 +104,7 @@ public class MinecraftReflectionTest {
assertEquals(ChunkCoordIntPair.class, MinecraftReflection.getChunkCoordIntPair()); assertEquals(ChunkCoordIntPair.class, MinecraftReflection.getChunkCoordIntPair());
} }
@Test /* @Test
public void testWatchableObject() { public void testWatchableObject() {
assertEquals(WatchableObject.class, MinecraftReflection.getWatchableObjectClass()); assertEquals(WatchableObject.class, MinecraftReflection.getWatchableObjectClass());
} */ } */

View File

@ -10,6 +10,8 @@ import java.io.IOException;
import net.minecraft.server.v1_8_R2.IntHashMap; import net.minecraft.server.v1_8_R2.IntHashMap;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
@ -31,7 +33,7 @@ public class StreamSerializerTest {
assertEquals(IntHashMap.class, MinecraftReflection.getIntHashMapClass()); assertEquals(IntHashMap.class, MinecraftReflection.getIntHashMapClass());
} }
/* @Test @Test
public void testSerializer() throws IOException { public void testSerializer() throws IOException {
ItemStack before = new ItemStack(Material.GOLD_AXE); ItemStack before = new ItemStack(Material.GOLD_AXE);
@ -41,7 +43,7 @@ public class StreamSerializerTest {
assertEquals(before.getType(), after.getType()); assertEquals(before.getType(), after.getType());
assertEquals(before.getAmount(), after.getAmount()); assertEquals(before.getAmount(), after.getAmount());
} */ }
@Test @Test
public void testStrings() throws IOException { public void testStrings() throws IOException {
@ -59,8 +61,8 @@ public class StreamSerializerTest {
assertEquals(initial, deserialized); assertEquals(initial, deserialized);
} }
/* TODO This is actually an issue // TODO This is an actual issue
@Test /* @Test
public void testCompound() throws IOException { public void testCompound() throws IOException {
StreamSerializer serializer = new StreamSerializer(); StreamSerializer serializer = new StreamSerializer();
NbtCompound initial = NbtFactory.ofCompound("tag"); NbtCompound initial = NbtFactory.ofCompound("tag");

View File

@ -0,0 +1,73 @@
/**
* ProtocolLib - Bukkit server library that allows access to the Minecraft protocol.
* Copyright (C) 2015 dmulloy2
*
* This program is free software; you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with this program;
* if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
* 02111-1307 USA
*/
package com.comphenix.protocol.wrappers;
import org.bukkit.Color;
import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_8_R2.inventory.CraftItemFactory;
import org.bukkit.inventory.ItemFactory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
/**
* @author dmulloy2
*/
public class ItemFactoryDelegate implements ItemFactory {
private final CraftItemFactory factory;
private final ItemMeta mocked;
public ItemFactoryDelegate(ItemMeta mocked) {
this.factory = CraftItemFactory.instance();
this.mocked = mocked;
}
@Override
public ItemMeta asMetaFor(ItemMeta meta, ItemStack stack) throws IllegalArgumentException {
return factory.asMetaFor(meta, stack);
}
@Override
public ItemMeta asMetaFor(ItemMeta meta, Material material) throws IllegalArgumentException {
return factory.asMetaFor(meta, material);
}
@Override
public boolean equals(ItemMeta meta1, ItemMeta meta2) throws IllegalArgumentException {
return factory.equals(meta1, meta2);
}
@Override
public Color getDefaultLeatherColor() {
return factory.getDefaultLeatherColor();
}
@Override
public ItemMeta getItemMeta(Material arg0) {
return mocked;
}
@Override
public boolean isApplicable(ItemMeta meta, ItemStack itemstack) throws IllegalArgumentException {
return factory.isApplicable(meta, itemstack);
}
@Override
public boolean isApplicable(ItemMeta meta, Material material) throws IllegalArgumentException {
return factory.isApplicable(meta, material);
}
}

View File

@ -1,28 +1,31 @@
package com.comphenix.protocol.wrappers; package com.comphenix.protocol.wrappers;
import org.bukkit.craftbukkit.v1_8_R2.inventory.CraftItemFactory; import static org.junit.Assert.assertEquals;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PowerMockIgnore; import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.core.classloader.annotations.PrepareForTest;
import com.comphenix.protocol.BukkitInitialization; import com.comphenix.protocol.BukkitInitialization;
@RunWith(org.powermock.modules.junit4.PowerMockRunner.class) @RunWith(org.powermock.modules.junit4.PowerMockRunner.class)
@PowerMockIgnore({ "org.apache.log4j.*", "org.apache.logging.*", "org.bukkit.craftbukkit.libs.jline.*" }) @PowerMockIgnore({ "org.apache.log4j.*", "org.apache.logging.*", "org.bukkit.craftbukkit.libs.jline.*" })
@PrepareForTest(CraftItemFactory.class) //@PrepareForTest(CraftItemFactory.class)
public class WrappedWatchableObjectTest { public class WrappedWatchableObjectTest {
@BeforeClass @BeforeClass
public static void initializeBukkit() throws IllegalAccessException { public static void initializeBukkit() throws IllegalAccessException {
BukkitInitialization.initializeItemMeta(); BukkitInitialization.initializeItemMeta();
} }
/* @Test @Test
public void testItemStack() { public void testItemStack() {
final ItemStack stack = new ItemStack(Material.GOLD_AXE); final ItemStack stack = new ItemStack(Material.GOLD_AXE);
final WrappedWatchableObject test = new WrappedWatchableObject(0, stack); final WrappedWatchableObject test = new WrappedWatchableObject(0, stack);
ItemStack value = (ItemStack) test.getValue(); ItemStack value = (ItemStack) test.getValue();
assertEquals(value.getType(), stack.getType()); assertEquals(value.getType(), stack.getType());
} */ }
} }