Archiviert
13
0

Update tests for 1.8.5

Dieser Commit ist enthalten in:
Dan Mulloy 2015-05-22 14:35:58 -04:00
Ursprung eca168edcf
Commit 99dea686a9
12 geänderte Dateien mit 39 neuen und 37 gelöschten Zeilen

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

@ -2,7 +2,7 @@ package com.comphenix.protocol;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when; 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.Bukkit;
import org.bukkit.Server; import org.bukkit.Server;

Datei anzeigen

@ -27,7 +27,7 @@ import java.lang.reflect.Array;
import java.util.List; import java.util.List;
import java.util.UUID; 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.apache.commons.lang.SerializationUtils;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;

Datei anzeigen

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

Datei anzeigen

@ -8,7 +8,7 @@ import java.io.DataInputStream;
import java.io.DataOutputStream; import java.io.DataOutputStream;
import java.io.IOException; 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.Material;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;

Datei anzeigen

@ -15,15 +15,15 @@ public class ChunkCoordIntPairTest {
@Test @Test
public void 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); ChunkCoordIntPair specific = ChunkCoordIntPair.getConverter().getSpecific(pair);
assertEquals(1, specific.getChunkX()); assertEquals(1, specific.getChunkX());
assertEquals(2, specific.getChunkZ()); assertEquals(2, specific.getChunkZ());
net.minecraft.server.v1_8_R2.ChunkCoordIntPair roundtrip = net.minecraft.server.v1_8_R3.ChunkCoordIntPair roundtrip =
(net.minecraft.server.v1_8_R2.ChunkCoordIntPair) ChunkCoordIntPair.getConverter(). (net.minecraft.server.v1_8_R3.ChunkCoordIntPair) ChunkCoordIntPair.getConverter().
getGeneric(net.minecraft.server.v1_8_R2.ChunkCoordIntPair.class, specific); getGeneric(net.minecraft.server.v1_8_R3.ChunkCoordIntPair.class, specific);
assertEquals(1, roundtrip.x); assertEquals(1, roundtrip.x);
assertEquals(2, roundtrip.z); assertEquals(2, roundtrip.z);

Datei anzeigen

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

Datei anzeigen

@ -18,7 +18,7 @@ package com.comphenix.protocol.wrappers;
import org.bukkit.Color; import org.bukkit.Color;
import org.bukkit.Material; 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.ItemFactory;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.ItemMeta;

Datei anzeigen

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