Properly initialize required internals

This commit is contained in:
Dan Mulloy 2015-06-16 20:09:46 -04:00
parent f5f3eef988
commit 6e553bc59d
2 changed files with 15 additions and 13 deletions

View File

@ -24,10 +24,20 @@ import org.bukkit.inventory.ItemStack;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PowerMockIgnore;
import com.comphenix.protocol.BukkitInitialization;
@RunWith(org.powermock.modules.junit4.PowerMockRunner.class)
@PowerMockIgnore({ "org.apache.log4j.*", "org.apache.logging.*", "org.bukkit.craftbukkit.libs.jline.*" })
public class MinecraftReflectionTest {
@BeforeClass
public static void initializeBukkit() throws IllegalAccessException {
BukkitInitialization.initializeItemMeta();
}
// Mocking objects
private interface FakeEntity {
public Entity getBukkitEntity();
@ -37,17 +47,6 @@ public class MinecraftReflectionTest {
public Block getBukkitEntity();
}
@BeforeClass
public static void initializeReflection() throws IllegalAccessException {
BukkitInitialization.initializePackage();
// Set up a package with no class loader knowledge
MinecraftReflection.minecraftPackage = new CachedPackage(
MinecraftReflection.getMinecraftPackage(),
ClassSource.fromClassLoader()
);
}
@AfterClass
public static void undoMocking() {
// NOP

View File

@ -22,6 +22,8 @@ import org.bukkit.Location;
import org.bukkit.Material;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PowerMockIgnore;
import com.comphenix.protocol.BukkitInitialization;
import com.comphenix.protocol.reflect.EquivalentConverter;
@ -30,12 +32,13 @@ import com.comphenix.protocol.utility.MinecraftReflection;
/**
* @author dmulloy2
*/
@RunWith(org.powermock.modules.junit4.PowerMockRunner.class)
@PowerMockIgnore({ "org.apache.log4j.*", "org.apache.logging.*", "org.bukkit.craftbukkit.libs.jline.*" })
public class MultiBlockChangeTest {
@BeforeClass
public static void initializeBukkit() throws IllegalAccessException {
BukkitInitialization.initializePackage();
BukkitInitialization.initializeItemMeta();
}
@Test