summaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authorCeltic Minstrel <celtic.minstrel.ca@some.place>2012-02-25 17:57:42 -0500
committerEvilSeph <evilseph@gmail.com>2012-02-25 18:06:20 -0500
commit2ba3ab3fb820c07877f50eee967aed2cdeff51da (patch)
tree7213ef0887d968131460b5a528f8c78569416fec /src/test
parent1c9d419c27e52347122f2eb43e294a36e0613501 (diff)
downloadbukkit-2ba3ab3fb820c07877f50eee967aed2cdeff51da.tar
bukkit-2ba3ab3fb820c07877f50eee967aed2cdeff51da.tar.gz
bukkit-2ba3ab3fb820c07877f50eee967aed2cdeff51da.tar.lz
bukkit-2ba3ab3fb820c07877f50eee967aed2cdeff51da.tar.xz
bukkit-2ba3ab3fb820c07877f50eee967aed2cdeff51da.zip
[Bleeding] Fixed potion tests.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/org/bukkit/potion/PotionTest.java41
1 files changed, 28 insertions, 13 deletions
diff --git a/src/test/java/org/bukkit/potion/PotionTest.java b/src/test/java/org/bukkit/potion/PotionTest.java
index fe641b86..afc54352 100644
--- a/src/test/java/org/bukkit/potion/PotionTest.java
+++ b/src/test/java/org/bukkit/potion/PotionTest.java
@@ -6,7 +6,6 @@ import static org.hamcrest.Matchers.is;
import org.bukkit.Material;
import org.bukkit.entity.LivingEntity;
import org.bukkit.inventory.ItemStack;
-import org.bukkit.potion.Potion.Tier;
import org.junit.Test;
public class PotionTest {
@@ -25,7 +24,7 @@ public class PotionTest {
potion = Potion.fromDamage(PotionType.POISON.getDamageValue() | SPLASH_BIT);
assertTrue(potion.getType() == PotionType.POISON && potion.isSplash());
potion = Potion.fromDamage(0x25 /* Potion of Healing II */);
- assertTrue(potion.getType() == PotionType.INSTANT_HEAL && potion.getTier() == Tier.TWO);
+ assertTrue(potion.getType() == PotionType.INSTANT_HEAL && potion.getLevel() == 2);
}
@Test(expected = IllegalArgumentException.class)
@@ -45,6 +44,22 @@ public class PotionTest {
@Test
public void setExtended() {
+ PotionEffectType.registerPotionEffectType(new PotionEffectType(19){
+ @Override
+ public double getDurationModifier() {
+ return 1;
+ }
+
+ @Override
+ public String getName() {
+ return "Poison";
+ }
+
+ @Override
+ public boolean isInstant() {
+ return false;
+ }
+ });
Potion potion = new Potion(PotionType.POISON);
assertFalse(potion.hasExtendedDuration());
potion.setHasExtendedDuration(true);
@@ -62,32 +77,32 @@ public class PotionTest {
}
@Test
- public void setTier() {
+ public void setLevel() {
Potion potion = new Potion(PotionType.POISON);
- assertThat(potion.getTier(), is(Tier.ONE));
- potion.setTier(Tier.TWO);
- assertThat(potion.getTier(), is(Tier.TWO));
- assertTrue(potion.toDamageValue() == (PotionType.POISON.getDamageValue() | potion.getTier().getDamageBit()));
+ assertEquals(1, potion.getLevel());
+ potion.setLevel(2);
+ assertEquals(2, potion.getLevel());
+ assertTrue((potion.toDamageValue() & 0x3F) == (PotionType.POISON.getDamageValue() | 0x20));
}
@Test
public void useNulls() {
try {
- new Potion(null);
- fail("cannot use null type in constructor");
+ new Potion(null, 2);
+ fail("cannot use null type in constructor with a level");
} catch (IllegalArgumentException ex) {
}
try {
- new Potion(PotionType.POISON, null);
- fail("cannot use null tier in constructor");
+ new Potion(PotionType.POISON, 3);
+ fail("level must be less than 3 in constructor");
} catch (IllegalArgumentException ex) {
}
Potion potion = new Potion(PotionType.POISON);
try {
- potion.setTier(null);
- fail("cannot set a null tier");
+ potion.setLevel(3);
+ fail("level must be set less than 3");
} catch (IllegalArgumentException ex) {
}