mirror of
https://github.com/dmulloy2/ProtocolLib.git
synced 2024-11-27 13:15:52 +01:00
Properly initialize required internals
This commit is contained in:
parent
f5f3eef988
commit
6e553bc59d
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user