From 8e11a406628c9280cd994d7bd329a0346558c775 Mon Sep 17 00:00:00 2001 From: "Kristian S. Stangeland" Date: Thu, 11 Apr 2013 22:51:44 +0200 Subject: [PATCH] Update unit test to 1.5.1 --- .../protocol/reflect/instances/DefaultInstances.java | 1 + .../com/comphenix/protocol/BukkitInitialization.java | 12 ++++++++++-- .../protocol/events/PacketContainerTest.java | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/instances/DefaultInstances.java b/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/instances/DefaultInstances.java index 826a4ecd..faaf84fc 100644 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/instances/DefaultInstances.java +++ b/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/instances/DefaultInstances.java @@ -327,6 +327,7 @@ public class DefaultInstances implements InstanceProvider { try { return (T) constructor.newInstance(params); } catch (Exception e) { + e.printStackTrace(); // Cannot create it return null; } diff --git a/ProtocolLib/src/test/java/com/comphenix/protocol/BukkitInitialization.java b/ProtocolLib/src/test/java/com/comphenix/protocol/BukkitInitialization.java index 9fac9cac..9012e8a8 100644 --- a/ProtocolLib/src/test/java/com/comphenix/protocol/BukkitInitialization.java +++ b/ProtocolLib/src/test/java/com/comphenix/protocol/BukkitInitialization.java @@ -4,8 +4,10 @@ import static org.mockito.Matchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; +import net.minecraft.server.StatisticList; + // Will have to be updated for every version though -import org.bukkit.craftbukkit.v1_4_R1.inventory.CraftItemFactory; +import org.bukkit.craftbukkit.inventory.CraftItemFactory; import org.bukkit.Bukkit; import org.bukkit.Material; @@ -34,6 +36,12 @@ public class BukkitInitialization { initializePackage(); + try { + StatisticList.b(); + } catch (Exception e) { + // Swallow + } + // Mock the server object Server mockedServer = mock(Server.class); ItemFactory mockedFactory = mock(CraftItemFactory.class); @@ -55,6 +63,6 @@ public class BukkitInitialization { */ public static void initializePackage() { // Initialize reflection - MinecraftReflection.setMinecraftPackage("net.minecraft.server.v1_4_R1", "org.bukkit.craftbukkit.v1_4_R1"); + MinecraftReflection.setMinecraftPackage("net.minecraft.server", "org.bukkit.craftbukkit"); } } diff --git a/ProtocolLib/src/test/java/com/comphenix/protocol/events/PacketContainerTest.java b/ProtocolLib/src/test/java/com/comphenix/protocol/events/PacketContainerTest.java index 1b66511e..f9a7c891 100644 --- a/ProtocolLib/src/test/java/com/comphenix/protocol/events/PacketContainerTest.java +++ b/ProtocolLib/src/test/java/com/comphenix/protocol/events/PacketContainerTest.java @@ -22,7 +22,7 @@ import java.lang.reflect.Array; import java.util.List; // Will have to be updated for every version though -import org.bukkit.craftbukkit.v1_4_R1.inventory.CraftItemFactory; +import org.bukkit.craftbukkit.inventory.CraftItemFactory; import org.bukkit.Material; import org.bukkit.WorldType;