diff options
author | Thinkofdeath <thinkofdeath@spigotmc.org> | 2014-11-26 08:32:16 +1100 |
---|---|---|
committer | md_5 <git@md-5.net> | 2014-11-28 17:16:30 +1100 |
commit | 24557bc2b37deb6a0edf497d547471832457b1dd (patch) | |
tree | c560572889a3b0b34964a0cddb35dc87fda3c914 /src/test/java/org | |
parent | a4805dbd77da057cc1ea0bf344379bc6e53ca1f6 (diff) | |
download | craftbukkit-24557bc2b37deb6a0edf497d547471832457b1dd.tar craftbukkit-24557bc2b37deb6a0edf497d547471832457b1dd.tar.gz craftbukkit-24557bc2b37deb6a0edf497d547471832457b1dd.tar.lz craftbukkit-24557bc2b37deb6a0edf497d547471832457b1dd.tar.xz craftbukkit-24557bc2b37deb6a0edf497d547471832457b1dd.zip |
Update to Minecraft 1.8
For more information please see http://www.spigotmc.org/
Diffstat (limited to 'src/test/java/org')
6 files changed, 77 insertions, 42 deletions
diff --git a/src/test/java/org/bukkit/DyeColorsTest.java b/src/test/java/org/bukkit/DyeColorsTest.java index 0e3a7c75..f0b889b3 100644 --- a/src/test/java/org/bukkit/DyeColorsTest.java +++ b/src/test/java/org/bukkit/DyeColorsTest.java @@ -7,6 +7,7 @@ import java.util.ArrayList; import java.util.List; import net.minecraft.server.EntitySheep; +import net.minecraft.server.EnumColor; import net.minecraft.server.ItemDye; import org.bukkit.support.AbstractTestingBase; @@ -33,7 +34,7 @@ public class DyeColorsTest extends AbstractTestingBase { @Test public void checkColor() { Color color = dye.getColor(); - float[] nmsColorArray = EntitySheep.bp[dye.getWoolData()]; + float[] nmsColorArray = EntitySheep.a(EnumColor.fromColorIndex(dye.getWoolData())); Color nmsColor = Color.fromRGB((int) (nmsColorArray[0] * 255), (int) (nmsColorArray[1] * 255), (int) (nmsColorArray[2] * 255)); assertThat(color, is(nmsColor)); } @@ -41,7 +42,7 @@ public class DyeColorsTest extends AbstractTestingBase { @Test public void checkFireworkColor() { Color color = dye.getFireworkColor(); - int nmsColor = ItemDye.c[dye.getDyeData()]; + int nmsColor = ItemDye.a[dye.getDyeData()]; assertThat(color, is(Color.fromRGB(nmsColor))); } } diff --git a/src/test/java/org/bukkit/PerMaterialTest.java b/src/test/java/org/bukkit/PerMaterialTest.java index a33fcbff..f689cbf4 100644 --- a/src/test/java/org/bukkit/PerMaterialTest.java +++ b/src/test/java/org/bukkit/PerMaterialTest.java @@ -23,16 +23,18 @@ import org.junit.runners.Parameterized.Parameter; import org.junit.runners.Parameterized.Parameters; import com.google.common.collect.Lists; +import java.util.Map; +import net.minecraft.server.Block; import net.minecraft.server.Blocks; import org.bukkit.craftbukkit.util.CraftMagicNumbers; @RunWith(Parameterized.class) public class PerMaterialTest extends AbstractTestingBase { - private static int[] fireValues; + private static Map<Block, Integer> fireValues; @BeforeClass public static void getFireValues() { - fireValues = Util.getInternalState(BlockFire.class, Blocks.FIRE, "a"); + fireValues = Util.getInternalState(BlockFire.class, Blocks.FIRE, "S"); } @Parameters(name= "{index}: {0}") @@ -120,7 +122,8 @@ public class PerMaterialTest extends AbstractTestingBase { @Test public void isBurnable() { if (material.isBlock()) { - assertThat(material.isBurnable(), is(fireValues[material.getId()] > 0)); + Block block = CraftMagicNumbers.getBlock(material); + assertThat(material.isBurnable(), is(fireValues.containsKey(block) && fireValues.get(block) > 0)); } else { assertFalse(material.isBurnable()); } @@ -129,7 +132,7 @@ public class PerMaterialTest extends AbstractTestingBase { @Test public void isOccluding() { if (material.isBlock()) { - assertThat(material.isOccluding(), is(CraftMagicNumbers.getBlock(material).r())); + assertThat(material.isOccluding(), is(CraftMagicNumbers.getBlock(material).isOccluding())); } else { assertFalse(material.isOccluding()); } diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java index 2331c180..11d29069 100644 --- a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java +++ b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java @@ -8,15 +8,19 @@ import java.util.List; import org.bukkit.Bukkit; import org.bukkit.Color; +import org.bukkit.DyeColor; import org.bukkit.FireworkEffect; import org.bukkit.Material; import org.bukkit.FireworkEffect.Type; +import org.bukkit.block.banner.Pattern; +import org.bukkit.block.banner.PatternType; import org.bukkit.craftbukkit.inventory.ItemStackTest.StackProvider; import org.bukkit.craftbukkit.inventory.ItemStackTest.StackWrapper; import org.bukkit.craftbukkit.inventory.ItemStackTest.BukkitWrapper; import org.bukkit.craftbukkit.inventory.ItemStackTest.CraftWrapper; import org.bukkit.enchantments.Enchantment; import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.BannerMeta; import org.bukkit.inventory.meta.BookMeta; import org.bukkit.inventory.meta.EnchantmentStorageMeta; import org.bukkit.inventory.meta.FireworkEffectMeta; @@ -25,7 +29,6 @@ import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.LeatherArmorMeta; import org.bukkit.inventory.meta.MapMeta; import org.bukkit.inventory.meta.PotionMeta; -import org.bukkit.inventory.meta.SkullMeta; import org.bukkit.potion.PotionEffectType; import org.bukkit.support.AbstractTestingBase; import org.junit.Test; @@ -192,6 +195,15 @@ public class ItemMetaTest extends AbstractTestingBase { cleanStack.setItemMeta(meta); return cleanStack; } + }, + new StackProvider(Material.BANNER) { + @Override ItemStack operate(ItemStack cleanStack) { + final BannerMeta meta = (BannerMeta) cleanStack.getItemMeta(); + meta.setBaseColor(DyeColor.CYAN); + meta.addPattern(new Pattern(DyeColor.WHITE, PatternType.BRICKS)); + cleanStack.setItemMeta(meta); + return cleanStack; + } } ); diff --git a/src/test/java/org/bukkit/craftbukkit/updater/BukkitDLUpdaterServiceTest.java b/src/test/java/org/bukkit/craftbukkit/updater/BukkitDLUpdaterServiceTest.java deleted file mode 100644 index df7437c9..00000000 --- a/src/test/java/org/bukkit/craftbukkit/updater/BukkitDLUpdaterServiceTest.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.bukkit.craftbukkit.updater; - -import static org.junit.Assert.*; -import static org.hamcrest.Matchers.*; - -import java.io.FileNotFoundException; -import java.io.IOException; - -import org.junit.Test; - -public class BukkitDLUpdaterServiceTest { - @Test(expected=IOException.class) - public void testHostNotFound() throws IOException { - BukkitDLUpdaterService service = new BukkitDLUpdaterService("404.example.org"); - - service.fetchArtifact("rb"); - } - - @Test(expected=FileNotFoundException.class) - public void testArtifactNotFound() throws IOException { - BukkitDLUpdaterService service = new BukkitDLUpdaterService("dl.bukkit.org"); - - service.fetchArtifact("meep"); - } - - @Test - public void testArtifactExists() throws IOException { - BukkitDLUpdaterService service = new BukkitDLUpdaterService("dl.bukkit.org"); - - assertThat(service.fetchArtifact("latest-dev"), is(not(nullValue()))); - } -} diff --git a/src/test/java/org/bukkit/support/AbstractTestingBase.java b/src/test/java/org/bukkit/support/AbstractTestingBase.java index 7c4484f0..b280ebe4 100644 --- a/src/test/java/org/bukkit/support/AbstractTestingBase.java +++ b/src/test/java/org/bukkit/support/AbstractTestingBase.java @@ -15,11 +15,62 @@ import org.junit.BeforeClass; * extend this class to solve it. */ public abstract class AbstractTestingBase { - public static final List<Material> INVALIDATED_MATERIALS = ImmutableList.<Material>builder().add(Material.BREWING_STAND, Material.BED_BLOCK, Material.NETHER_WARTS, Material.CAULDRON, Material.FLOWER_POT, Material.CROPS, Material.SUGAR_CANE_BLOCK, Material.CAKE_BLOCK, Material.SKULL, Material.PISTON_EXTENSION, Material.PISTON_MOVING_PIECE, Material.GLOWING_REDSTONE_ORE, Material.DIODE_BLOCK_ON, Material.PUMPKIN_STEM, Material.SIGN_POST, Material.REDSTONE_COMPARATOR_ON, Material.TRIPWIRE, Material.REDSTONE_LAMP_ON, Material.MELON_STEM, Material.REDSTONE_TORCH_OFF, Material.REDSTONE_COMPARATOR_OFF, Material.REDSTONE_WIRE, Material.WALL_SIGN, Material.DIODE_BLOCK_OFF, Material.IRON_DOOR_BLOCK, Material.WOODEN_DOOR).add(Material.LOCKED_CHEST).build(); + public static final List<Material> INVALIDATED_MATERIALS = ImmutableList.<Material>builder() + .add( + Material.BREWING_STAND, + Material.BED_BLOCK, + Material.NETHER_WARTS, + Material.CAULDRON, + Material.FLOWER_POT, + Material.CROPS, + Material.SUGAR_CANE_BLOCK, + Material.CAKE_BLOCK, + Material.SKULL, + Material.PISTON_EXTENSION, + Material.PISTON_MOVING_PIECE, + Material.GLOWING_REDSTONE_ORE, + Material.DIODE_BLOCK_ON, + Material.PUMPKIN_STEM, + Material.SIGN_POST, + Material.REDSTONE_COMPARATOR_ON, + Material.TRIPWIRE, + Material.REDSTONE_LAMP_ON, + Material.MELON_STEM, + Material.REDSTONE_TORCH_OFF, + Material.REDSTONE_COMPARATOR_OFF, + Material.REDSTONE_WIRE, + Material.WALL_SIGN, + Material.DIODE_BLOCK_OFF, + Material.IRON_DOOR_BLOCK, + Material.WOODEN_DOOR, + Material.LOCKED_CHEST, + Material.WATER, + Material.STATIONARY_WATER, + Material.LAVA, + Material.STATIONARY_LAVA, + Material.DOUBLE_STEP, + Material.DOUBLE_STEP, + Material.FIRE, + Material.PORTAL, + Material.ENDER_PORTAL, + Material.WOOD_DOUBLE_STEP, + Material.COCOA, + Material.CARROT, + Material.POTATO, + Material.STANDING_BANNER, + Material.WALL_BANNER, + Material.DAYLIGHT_DETECTOR_INVERTED, + Material.DOUBLE_STONE_SLAB2, + Material.SPRUCE_DOOR, + Material.BIRCH_DOOR, + Material.JUNGLE_DOOR, + Material.ACACIA_DOOR, + Material.DARK_OAK_DOOR + ).build(); @BeforeClass public static void setup() { - DispenserRegistry.b(); + DispenserRegistry.c(); DummyServer.setup(); DummyPotions.setup(); DummyEnchantments.setup(); diff --git a/src/test/java/org/bukkit/support/DummyEnchantments.java b/src/test/java/org/bukkit/support/DummyEnchantments.java index 5ed00a72..a0e0396b 100644 --- a/src/test/java/org/bukkit/support/DummyEnchantments.java +++ b/src/test/java/org/bukkit/support/DummyEnchantments.java @@ -4,7 +4,7 @@ import net.minecraft.server.Enchantment; public class DummyEnchantments { static { - Enchantment.byId.getClass(); + Enchantment.getNames(); org.bukkit.enchantments.Enchantment.stopAcceptingRegistrations(); } |