diff --git a/src/PlayerTest.java b/src/PlayerTest.java index fcf0fdb..e86694e 100644 --- a/src/PlayerTest.java +++ b/src/PlayerTest.java @@ -6,14 +6,27 @@ import java.io.*; import static org.junit.Assert.*; +/** + * 2019-03-10 + * Authors: Harkamal, Vikram, Haris, Siddhant, Nathan + * Player test, checks all the info about the player such as inventory, health, etc + * + */ + public class PlayerTest { + /** + * Test this getter method to see if it returns the default values if called. + */ @Test public void getCargoSpace() { Player player = new Player(); assertEquals("The instance variable for the object does not line up with the rest of the class", 60, player.getCargoSpace()); } + /** + * Test this setter by changing the value of the instance variable and then seeing if the getter returns the same value + */ @Test public void setCargoSpace() { Player player = new Player(); @@ -21,12 +34,18 @@ public class PlayerTest { assertEquals("The instance variable for the object does not line up with the rest of the class", 10, player.getCargoSpace()); } + /** + * Test this getter method to see if it returns the default values if called. + */ @Test public void getAttackingShips() { Player player = new Player(); assertEquals("The instance variable for the object does not line up with the rest of the class", true, player.getAttackingShips()); } + /** + * Test this setter by changing the value of the instance variable and then seeing if the getter returns the same value + */ @Test public void setAttackingShips() { Player player = new Player(); @@ -34,12 +53,18 @@ public class PlayerTest { assertEquals("The instance variable for the object does not line up with the rest of the class", false, player.getAttackingShips()); } + /** + * Test this getter method to see if it returns the default values if called. + */ @Test public void getRetire() { Player player = new Player(); assertEquals("The instance variable for the object does not line up with the rest of the class", false, player.getRetire()); } + /** + * Test this setter by changing the value of the instance variable and then seeing if the getter returns the same value + */ @Test public void setRetire() { Player player = new Player(); @@ -47,12 +72,18 @@ public class PlayerTest { assertEquals("The instance variable for the object does not line up with the rest of the class", true, player.getRetire()); } + /** + * Test this getter method to see if it returns the default values if called. + */ @Test public void getName() { Player player = new Player(); assertEquals("The instance variable for the object does not line up with the rest of the class", "Taipan", player.getName()); } + /** + * Test this setter by changing the value of the instance variable and then seeing if the getter returns the same value + */ @Test public void setName() { Player player = new Player(); @@ -60,12 +91,18 @@ public class PlayerTest { assertEquals("The instance variable for the object does not line up with the rest of the class", "a", player.getName()); } + /** + * Test this getter method to see if it returns the default values if called. + */ @Test public void getHP() { Player player = new Player(); assertEquals("The instance variable for the object does not line up with the rest of the class", 100, player.getHP()); } + /** + * Test this setter by changing the value of the instance variable and then seeing if the getter returns the same value + */ @Test public void setHP() { Player player = new Player(); @@ -73,12 +110,18 @@ public class PlayerTest { assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getHP()); } + /** + * Test this getter method to see if it returns the default values if called. + */ @Test public void getBank() { Player player = new Player(); assertEquals("The instance variable for the object does not line up with the rest of the class", 0, player.getBank()); } + /** + * Test this setter by changing the value of the instance variable and then seeing if the getter returns the same value + */ @Test public void setBank() { Player player = new Player(); @@ -86,12 +129,18 @@ public class PlayerTest { assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getBank()); } + /** + * Test this getter method to see if it returns the default values if called. + */ @Test public void getMoney() { Player player = new Player(); assertEquals("The instance variable for the object does not line up with the rest of the class", 0, player.getMoney()); } + /** + * Test this setter by changing the value of the instance variable and then seeing if the getter returns the same value + */ @Test public void setMoney() { Player player = new Player(); @@ -99,12 +148,18 @@ public class PlayerTest { assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getMoney()); } + /** + * Test this getter method to see if it returns the default values if called. + */ @Test public void getOpiumHeld() { Player player = new Player(); assertEquals("The instance variable for the object does not line up with the rest of the class", 0, player.getOpiumHeld()); } + /** + * Test this setter by changing the value of the instance variable and then seeing if the getter returns the same value + */ @Test public void setOpiumHeld() { Player player = new Player(); @@ -112,12 +167,18 @@ public class PlayerTest { assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getOpiumHeld()); } + /** + * Test this getter method to see if it returns the default values if called. + */ @Test public void getSilkHeld() { Player player = new Player(); assertEquals("The instance variable for the object does not line up with the rest of the class", 0, player.getSilkHeld()); } + /** + * Test this setter by changing the value of the instance variable and then seeing if the getter returns the same value + */ @Test public void setSilkHeld() { Player player = new Player(); @@ -125,12 +186,18 @@ public class PlayerTest { assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getSilkHeld()); } + /** + * Test this getter method to see if it returns the default values if called. + */ @Test public void getGeneralHeld() { Player player = new Player(); assertEquals("The instance variable for the object does not line up with the rest of the class", 0, player.getGeneralHeld()); } + /** + * Test this setter by changing the value of the instance variable and then seeing if the getter returns the same value + */ @Test public void setGeneralHeld() { Player player = new Player(); @@ -138,12 +205,18 @@ public class PlayerTest { assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getGeneralHeld()); } + /** + * Test this getter method to see if it returns the default values if called. + */ @Test public void getArmsHeld() { Player player = new Player(); assertEquals("The instance variable for the object does not line up with the rest of the class", 0, player.getArmsHeld()); } + /** + * Test this setter by changing the value of the instance variable and then seeing if the getter returns the same value + */ @Test public void setArmsHeld() { Player player = new Player(); @@ -151,12 +224,18 @@ public class PlayerTest { assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getArmsHeld()); } + /** + * Test this getter method to see if it returns the default values if called. + */ @Test public void getLocation() { Player player = new Player(); assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getLocation()); } + /** + * Test this setter by changing the value of the instance variable and then seeing if the getter returns the same value + */ @Test public void setLocation() { Player player = new Player(); @@ -164,12 +243,18 @@ public class PlayerTest { assertEquals("The instance variable for the object does not line up with the rest of the class", 2, player.getLocation()); } + /** + * Test this getter method to see if it returns the default values if called. + */ @Test public void getGuns() { Player player = new Player(); assertEquals("The instance variable for the object does not line up with the rest of the class", 5, player.getGuns()); } + /** + * Test this setter by changing the value of the instance variable and then seeing if the getter returns the same value + */ @Test public void setGuns() { Player player = new Player(); @@ -177,12 +262,18 @@ public class PlayerTest { assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getGuns()); } + /** + * Test this getter method to see if it returns the default values if called. + */ @Test public void getDebt() { Player player = new Player(); assertEquals("The instance variable for the object does not line up with the rest of the class", 0, player.getDebt()); } + /** + * Test this setter by changing the value of the instance variable and then seeing if the getter returns the same value + */ @Test public void setDebt() { Player player = new Player(); @@ -190,12 +281,18 @@ public class PlayerTest { assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getDebt()); } + /** + * Test this getter method to see if it returns the default values if called. + */ @Test public void getwOpium() { Player player = new Player(); assertEquals("The instance variable for the object does not line up with the rest of the class", 0, player.getwOpium()); } + /** + * Test this setter by changing the value of the instance variable and then seeing if the getter returns the same value + */ @Test public void setwOpium() { Player player = new Player(); @@ -203,12 +300,18 @@ public class PlayerTest { assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getwOpium()); } + /** + * Test this getter method to see if it returns the default values if called. + */ @Test public void getwSilk() { Player player = new Player(); assertEquals("The instance variable for the object does not line up with the rest of the class", 0, player.getwSilk()); } + /** + * Test this setter by changing the value of the instance variable and then seeing if the getter returns the same value + */ @Test public void setwSilk() { Player player = new Player(); @@ -216,12 +319,18 @@ public class PlayerTest { assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getwSilk()); } + /** + * Test this getter method to see if it returns the default values if called. + */ @Test public void getwGeneral() { Player player = new Player(); assertEquals("The instance variable for the object does not line up with the rest of the class", 0, player.getwGeneral()); } + /** + * Test this setter by changing the value of the instance variable and then seeing if the getter returns the same value + */ @Test public void setwGeneral() { Player player = new Player(); @@ -229,12 +338,18 @@ public class PlayerTest { assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getwGeneral()); } + /** + * Test this getter method to see if it returns the default values if called. + */ @Test public void getwArms() { Player player = new Player(); assertEquals("The instance variable for the object does not line up with the rest of the class", 0, player.getwArms()); } + /** + * Test this setter by changing the value of the instance variable and then seeing if the getter returns the same value + */ @Test public void setwArms() { Player player = new Player(); @@ -242,12 +357,18 @@ public class PlayerTest { assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getwArms()); } + /** + * Test this getter method to see if it returns the default values if called. + */ @Test public void getOpiumPrice() { Player player = new Player(); assertEquals("The instance variable for the object does not line up with the rest of the class", 16000, player.getOpiumPrice()); } + /** + * Test this setter by changing the value of the instance variable and then seeing if the getter returns the same value + */ @Test public void setOpiumPrice() { Player player = new Player(); @@ -255,12 +376,18 @@ public class PlayerTest { assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getOpiumPrice()); } + /** + * Test this getter method to see if it returns the default values if called. + */ @Test public void getSilkPrice() { Player player = new Player(); assertEquals("The instance variable for the object does not line up with the rest of the class", 1600, player.getSilkPrice()); } + /** + * Test this setter by changing the value of the instance variable and then seeing if the getter returns the same value + */ @Test public void setSilkPrice() { Player player = new Player(); @@ -268,12 +395,18 @@ public class PlayerTest { assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getSilkPrice()); } + /** + * Test this getter method to see if it returns the default values if called. + */ @Test public void getArmsPrice() { Player player = new Player(); assertEquals("The instance variable for the object does not line up with the rest of the class", 160, player.getArmsPrice()); } + /** + * Test this setter by changing the value of the instance variable and then seeing if the getter returns the same value + */ @Test public void setArmsPrice() { Player player = new Player(); @@ -281,12 +414,18 @@ public class PlayerTest { assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getArmsPrice()); } + /** + * Test this getter method to see if it returns the default values if called. + */ @Test public void getGeneralPrice() { Player player = new Player(); assertEquals("The instance variable for the object does not line up with the rest of the class", 8, player.getGeneralPrice()); } + /** + * Test this setter by changing the value of the instance variable and then seeing if the getter returns the same value + */ @Test public void setGeneralPrice() { Player player = new Player(); @@ -294,12 +433,18 @@ public class PlayerTest { assertEquals("The instance variable for the object does not line up with the rest of the class", 1, player.getGeneralPrice()); } + /** + * Test this getter method to see if it returns the default values if called. + */ @Test public void getIsPriceChanged() { Player player = new Player(); assertEquals("The instance variable for the object does not line up with the rest of the class", 0, player.getIsPriceChanged()); } + /** + * Test this setter by changing the value of the instance variable and then seeing if the getter returns the same value + */ @Test public void setIsPriceChanged() { Player player = new Player();