From 43cee6311af8a5054d208aed903115c12e88a37c Mon Sep 17 00:00:00 2001 From: graywolf336 Date: Sun, 19 Jan 2014 16:01:12 -0600 Subject: [PATCH] Add two more tests and rename our Util test class to reflect the usage. --- ...tVectorsInside.java => TestUtilClass.java} | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) rename src/test/java/test/java/com/graywolf336/jail/{TestVectorsInside.java => TestUtilClass.java} (58%) diff --git a/src/test/java/test/java/com/graywolf336/jail/TestVectorsInside.java b/src/test/java/test/java/com/graywolf336/jail/TestUtilClass.java similarity index 58% rename from src/test/java/test/java/com/graywolf336/jail/TestVectorsInside.java rename to src/test/java/test/java/com/graywolf336/jail/TestUtilClass.java index 442a6c0..f1e7a84 100644 --- a/src/test/java/test/java/com/graywolf336/jail/TestVectorsInside.java +++ b/src/test/java/test/java/com/graywolf336/jail/TestUtilClass.java @@ -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 list; private Vector bottomCorner; private Vector topCorner; @Before public void setUp() throws Exception { + list = new ArrayList(); + 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())); + } }