Add two more tests and rename our Util test class to reflect the usage.

This commit is contained in:
graywolf336 2014-01-19 16:01:12 -06:00
parent f41ee77092
commit 43cee6311a

View File

@ -2,6 +2,10 @@ package test.java.com.graywolf336.jail;
import static org.junit.Assert.*;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.Material;
import org.bukkit.util.Vector;
import org.junit.After;
import org.junit.Before;
@ -9,12 +13,17 @@ import org.junit.Test;
import com.graywolf336.jail.Util;
public class TestVectorsInside {
public class TestUtilClass {
private List<String> list;
private Vector bottomCorner;
private Vector topCorner;
@Before
public void setUp() throws Exception {
list = new ArrayList<String>();
list.add(Material.SEEDS.toString());
list.add("coal_ore");
list.add("torch");
bottomCorner = new Vector(-10.50, 50.25, 100.00);
topCorner = new Vector(50, 100, 250);
}
@ -23,6 +32,7 @@ public class TestVectorsInside {
public void tearDown() throws Exception {
bottomCorner = null;
topCorner = null;
list = null;
}
@Test
@ -42,4 +52,18 @@ public class TestVectorsInside {
Vector halfAndHalf = new Vector(25, 75, 99);
assertFalse(Util.isInsideAB(halfAndHalf, bottomCorner, topCorner));
}
@Test
public void testInList() {
assertTrue(Util.isStringInsideList(list, "seeds"));
assertTrue(Util.isStringInsideList(list, Material.COAL_ORE.toString()));
assertTrue(Util.isStringInsideList(list, "tOrCh"));
}
@Test
public void testNotInList() {
assertFalse(Util.isStringInsideList(list, "dirt"));
assertFalse(Util.isStringInsideList(list, "SAND"));
assertFalse(Util.isStringInsideList(list, Material.BEDROCK.toString()));
}
}