Adding a test for checking the fallback methods in MinecraftReflection

This commit is contained in:
Kristian S. Stangeland 2013-12-04 17:48:51 +01:00
parent 398b1bc3be
commit 7055cadaef

View File

@ -0,0 +1,29 @@
package com.comphenix.protocol.utility;
import static org.junit.Assert.*;
import net.minecraft.server.v1_7_R1.NBTCompressedStreamTools;
import net.minecraft.util.com.google.common.collect.Maps;
import org.junit.BeforeClass;
import org.junit.Test;
import com.comphenix.protocol.BukkitInitialization;
public class MinecraftReflectionTest {
@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.fromMap(Maps.<String, Class<?>>newHashMap())
);
}
@Test
public void testNbtStreamTools() {
assertEquals(NBTCompressedStreamTools.class, MinecraftReflection.getNbtCompressedStreamToolsClass());
}
}