Update tests for 1.8.5

This commit is contained in:
Dan Mulloy 2015-05-22 14:35:58 -04:00
parent eca168edcf
commit 99dea686a9
12 changed files with 39 additions and 37 deletions

View File

@ -314,13 +314,13 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.8.3-R0.1-SNAPSHOT</version>
<version>1.8.5-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.8.3-R0.1-SNAPSHOT</version>
<version>1.8.5-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>

View File

@ -75,7 +75,7 @@ class CachedPackage {
return result;
} catch (ClassNotFoundException e) {
throw new RuntimeException("Cannot find class " + className, e);
throw new RuntimeException("Cannot find class " + combine(packageName, className), e);
}
}

View File

@ -21,7 +21,7 @@ package com.comphenix.protocol.utility;
*/
public final class Constants {
public static final String PACKAGE_VERSION = "v1_8_R2";
public static final String PACKAGE_VERSION = "v1_8_R3";
public static final String NMS = "net.minecraft.server." + PACKAGE_VERSION;
public static final String OBC = "org.bukkit.craftbukkit." + PACKAGE_VERSION;
}

View File

@ -1281,7 +1281,7 @@ public class MinecraftReflection {
*/
public static Class<?> getWatchableObjectClass() {
try {
return getMinecraftClass("WatchableObject");
return getMinecraftClass("DataWatcher$WatchableObject", "WatchableObject");
} catch (RuntimeException e) {
Method selected = FuzzyReflection.fromClass(getDataWatcherClass(), true).
getMethod(FuzzyMethodContract.newBuilder().
@ -2035,7 +2035,7 @@ public class MinecraftReflection {
success = getMinecraftClass(alias);
break;
} catch (RuntimeException e1) {
// Just swallow it...
e1.printStackTrace(); // TODO DEBUG
}
}

View File

@ -2,7 +2,7 @@ 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 net.minecraft.server.v1_8_R3.DispenserRegistry;
import org.bukkit.Bukkit;
import org.bukkit.Server;

View File

@ -27,7 +27,7 @@ import java.lang.reflect.Array;
import java.util.List;
import java.util.UUID;
import net.minecraft.server.v1_8_R2.MobEffect;
import net.minecraft.server.v1_8_R3.MobEffect;
import org.apache.commons.lang.SerializationUtils;
import org.bukkit.ChatColor;

View File

@ -4,12 +4,15 @@ import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
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.ServerPing;
import net.minecraft.server.v1_8_R2.ServerPing.ServerData;
import net.minecraft.server.v1_8_R2.ServerPing.ServerPingPlayerSample;
import net.minecraft.server.v1_8_R3.ChatComponentText;
import net.minecraft.server.v1_8_R3.ChunkCoordIntPair;
import net.minecraft.server.v1_8_R3.DataWatcher.WatchableObject;
import net.minecraft.server.v1_8_R3.IChatBaseComponent;
import net.minecraft.server.v1_8_R3.IChatBaseComponent.ChatSerializer;
import net.minecraft.server.v1_8_R3.NBTCompressedStreamTools;
import net.minecraft.server.v1_8_R3.ServerPing;
import net.minecraft.server.v1_8_R3.ServerPing.ServerData;
import net.minecraft.server.v1_8_R3.ServerPing.ServerPingPlayerSample;
import org.bukkit.block.Block;
import org.bukkit.entity.Entity;
@ -18,7 +21,6 @@ import org.junit.BeforeClass;
import org.junit.Test;
import com.comphenix.protocol.BukkitInitialization;
import com.google.common.collect.Maps;
public class MinecraftReflectionTest {
// Mocking objects
@ -37,7 +39,7 @@ public class MinecraftReflectionTest {
// Set up a package with no class loader knowledge
MinecraftReflection.minecraftPackage = new CachedPackage(
MinecraftReflection.getMinecraftPackage(),
ClassSource.fromMap(Maps.<String, Class<?>>newHashMap())
ClassSource.fromClassLoader()
);
}
@ -64,10 +66,10 @@ public class MinecraftReflectionTest {
MinecraftReflection.getBukkitEntity("Hello");
}
/* @Test
@Test
public void testNbtStreamTools() {
assertEquals(NBTCompressedStreamTools.class, MinecraftReflection.getNbtCompressedStreamToolsClass());
} */
}
@Test
public void testChatComponent() {
@ -79,10 +81,10 @@ public class MinecraftReflectionTest {
assertEquals(ChatComponentText.class, MinecraftReflection.getChatComponentTextClass());
}
/* @Test
@Test
public void testChatSerializer() {
assertEquals(ChatSerializer.class, MinecraftReflection.getChatSerializerClass());
} */
}
@Test
public void testServerPing() {
@ -104,8 +106,8 @@ public class MinecraftReflectionTest {
assertEquals(ChunkCoordIntPair.class, MinecraftReflection.getChunkCoordIntPair());
}
/* @Test
@Test
public void testWatchableObject() {
assertEquals(WatchableObject.class, MinecraftReflection.getWatchableObjectClass());
} */
}
}

View File

@ -8,7 +8,7 @@ import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import net.minecraft.server.v1_8_R2.IntHashMap;
import net.minecraft.server.v1_8_R3.IntHashMap;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;

View File

@ -15,15 +15,15 @@ public class ChunkCoordIntPairTest {
@Test
public void test() {
net.minecraft.server.v1_8_R2.ChunkCoordIntPair pair = new net.minecraft.server.v1_8_R2.ChunkCoordIntPair(1, 2);
net.minecraft.server.v1_8_R3.ChunkCoordIntPair pair = new net.minecraft.server.v1_8_R3.ChunkCoordIntPair(1, 2);
ChunkCoordIntPair specific = ChunkCoordIntPair.getConverter().getSpecific(pair);
assertEquals(1, specific.getChunkX());
assertEquals(2, specific.getChunkZ());
net.minecraft.server.v1_8_R2.ChunkCoordIntPair roundtrip =
(net.minecraft.server.v1_8_R2.ChunkCoordIntPair) ChunkCoordIntPair.getConverter().
getGeneric(net.minecraft.server.v1_8_R2.ChunkCoordIntPair.class, specific);
net.minecraft.server.v1_8_R3.ChunkCoordIntPair roundtrip =
(net.minecraft.server.v1_8_R3.ChunkCoordIntPair) ChunkCoordIntPair.getConverter().
getGeneric(net.minecraft.server.v1_8_R3.ChunkCoordIntPair.class, specific);
assertEquals(1, roundtrip.x);
assertEquals(2, roundtrip.z);

View File

@ -1,12 +1,12 @@
package com.comphenix.protocol.wrappers;
import static org.junit.Assert.assertEquals;
import net.minecraft.server.v1_8_R2.EntityHuman.EnumChatVisibility;
import net.minecraft.server.v1_8_R2.EnumDifficulty;
import net.minecraft.server.v1_8_R2.EnumProtocol;
import net.minecraft.server.v1_8_R2.PacketPlayInClientCommand.EnumClientCommand;
import net.minecraft.server.v1_8_R2.PacketPlayInUseEntity.EnumEntityUseAction;
import net.minecraft.server.v1_8_R2.WorldSettings.EnumGamemode;
import net.minecraft.server.v1_8_R3.EntityHuman.EnumChatVisibility;
import net.minecraft.server.v1_8_R3.EnumDifficulty;
import net.minecraft.server.v1_8_R3.EnumProtocol;
import net.minecraft.server.v1_8_R3.PacketPlayInClientCommand.EnumClientCommand;
import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity.EnumEntityUseAction;
import net.minecraft.server.v1_8_R3.WorldSettings.EnumGamemode;
import org.junit.BeforeClass;
import org.junit.Test;

View File

@ -18,7 +18,7 @@ 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.craftbukkit.v1_8_R3.inventory.CraftItemFactory;
import org.bukkit.inventory.ItemFactory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;

View File

@ -7,9 +7,9 @@ import static org.junit.Assert.assertTrue;
import java.util.Collection;
import java.util.List;
import net.minecraft.server.v1_8_R2.AttributeModifier;
import net.minecraft.server.v1_8_R2.PacketPlayOutUpdateAttributes;
import net.minecraft.server.v1_8_R2.PacketPlayOutUpdateAttributes.AttributeSnapshot;
import net.minecraft.server.v1_8_R3.AttributeModifier;
import net.minecraft.server.v1_8_R3.PacketPlayOutUpdateAttributes;
import net.minecraft.server.v1_8_R3.PacketPlayOutUpdateAttributes.AttributeSnapshot;
import org.junit.Before;
import org.junit.BeforeClass;