diff --git a/src/com/hotmail/kalebmarc/textfighter/item/ArmourTest.java b/src/com/hotmail/kalebmarc/textfighter/item/ArmourTest.java deleted file mode 100644 index c53ee0b3..00000000 --- a/src/com/hotmail/kalebmarc/textfighter/item/ArmourTest.java +++ /dev/null @@ -1,101 +0,0 @@ -package com.hotmail.kalebmarc.textfighter.item; - -import static org.junit.Assert.*; -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; - -import java.io.InputStream; -import java.io.PrintStream; -import java.io.PrintWriter; -import java.io.StringWriter; -import java.util.ArrayList; -import java.util.Scanner; - -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Rule; -import org.junit.Test; - -public class ArmourTest { - - static Armour none; - - static Armour basic; - - static Armour advanced; - - static InputStream sysInBackup; - - static ByteArrayInputStream in; - - @BeforeClass - public static void setUpBeforeClass() throws Exception { - none = new Armour("None", 0, 0, 1); - basic = new Armour("Basic", 400, 15, 5); - advanced = new Armour("Advanced", 750, 30, 7); - - none.setOwns(true); - - basic.setOwns(false); - - advanced.setOwns(true); - - Armour.set(0); - } - - @AfterClass - public static void tearDownAfterClass() throws Exception { - } - - @Before - public void setUp() throws Exception { - - sysInBackup = System.in; // backup System.in to restore it later - } - - @After - public void tearDown() throws Exception { - - System.setIn(sysInBackup); - } - - @Test - public void testGetArmours() { - - assertEquals(3, Armour.getArmours().size()); - - assertEquals("None", Armour.getArmours().get(0).getName()); - assertEquals(0, Armour.getArmours().get(0).getPrice()); - assertEquals(0, Armour.getArmours().get(0).getDamResist()); - assertEquals(1, Armour.getArmours().get(0).getLevel()); - - assertEquals( "Basic", Armour.getArmours().get(1).getName()); - assertEquals(400, Armour.getArmours().get(1).getPrice()); - assertEquals(15, Armour.getArmours().get(1).getDamResist()); - assertEquals(5, Armour.getArmours().get(1).getLevel()); - - assertEquals("Advanced", Armour.getArmours().get(2).getName()); - assertEquals(750, Armour.getArmours().get(2).getPrice()); - assertEquals(30, Armour.getArmours().get(2).getDamResist()); - assertEquals(7, Armour.getArmours().get(2).getLevel()); - } - - @Test - public void testChoose() { - - assertEquals(0, Armour.get()); - - ByteArrayInputStream chooseIn = new ByteArrayInputStream("2".getBytes()); - - System.setIn(chooseIn); - - Armour.choose(); - - System.setIn(sysInBackup); - - assertEquals(2, Armour.get()); - } -} diff --git a/src/com/hotmail/kalebmarc/textfighter/main/EnemyTest.java b/src/com/hotmail/kalebmarc/textfighter/main/EnemyTest.java deleted file mode 100644 index d6b5e737..00000000 --- a/src/com/hotmail/kalebmarc/textfighter/main/EnemyTest.java +++ /dev/null @@ -1,158 +0,0 @@ -package com.hotmail.kalebmarc.textfighter.main; - -import static org.junit.Assert.*; - -import java.util.ArrayList; -import java.util.Set; - -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; - -import com.hotmail.kalebmarc.textfighter.player.Xp; - -public class EnemyTest { - - public static Enemy darkElf; - public static Enemy ninja; - public static Enemy giantSpider; - public static Enemy zombie; - public static Enemy goblin; - public static Enemy ghost; - public static Enemy barbarian; - public static Enemy giantAnt; - public static Enemy evilUnicorn; - public static Enemy ogre; - - static ArrayList allEnemies; - - @BeforeClass - public static void setUpBeforeClass() throws Exception { - darkElf = new Enemy("Dark Elf", 45, 10, 15, 10, 15, 15, 5, 100, true, false); - ninja = new Enemy("Ninja", 75, 5, 15, 5, 15, 15, 1, 10, true, false); - giantSpider = new Enemy("Giant Spider", 35, 5, 10, 5, 10, 10, 5, 100, true, false); - zombie = new Enemy("Zombie", 20, 5, 15, 5, 15, 15, 1, 10, true, false); - goblin = new Enemy("Goblin", 60, 10, 20, 10, 20, 20, 1, 10, true, false); - ghost = new Enemy("Ghost", 85, 15, 25, 15, 25, 25, 1, 100, true, false); - barbarian = new Enemy("Barbarian", 50, 5, 15, 5, 15, 15, 5, 100, true, false); - giantAnt = new Enemy("Giant Ant", 30, 5, 10, 5, 10, 10, 1, 10, true, false); - evilUnicorn = new Enemy("Evil Unicorn", 35, 30, 40, 5, 15, 20, 5, 100, true, false); - ogre = new Enemy("Ogre", 90, 20, 50, 10, 30, 50, 5, 100, true, false); - - allEnemies = new ArrayList<>(); - - allEnemies.add(darkElf); - allEnemies.add(ninja); - allEnemies.add(giantSpider); - allEnemies.add(ghost); - allEnemies.add(barbarian); - allEnemies.add(giantAnt); - allEnemies.add(evilUnicorn); - allEnemies.add(ogre); - - Xp.setLevel(1); - } - - @AfterClass - public static void tearDownAfterClass() throws Exception { - } - - @Before - public void setUp() throws Exception { - } - - @After - public void tearDown() throws Exception { - } - - @Test - public void testGet() { - - Xp.setLevel(1); - - Enemy.encounterNew(); - - assertTrue(Enemy.get() instanceof Enemy); - - ArrayList suitableEnemies = new ArrayList(); - - suitableEnemies.add(ninja); - suitableEnemies.add(zombie); - suitableEnemies.add(goblin); - suitableEnemies.add(ghost); - suitableEnemies.add(giantAnt); - - assertTrue(suitableEnemies.contains(Enemy.get())); - - Xp.setLevel(15); - - suitableEnemies = new ArrayList(); - - suitableEnemies.add(darkElf); - suitableEnemies.add(giantSpider); - suitableEnemies.add(ghost); - suitableEnemies.add(barbarian); - suitableEnemies.add(evilUnicorn); - suitableEnemies.add(ogre); - - Enemy.encounterNew(); - - assertTrue(Enemy.get() instanceof Enemy); - - assertTrue(suitableEnemies.contains(Enemy.get())); - } - - @Test - public void testFindEnemy() { - - Xp.setLevel(1); - - Enemy.findEnemy(); - - assertTrue(Enemy.get() instanceof Enemy); - - ArrayList suitableEnemies = new ArrayList(); - - suitableEnemies.add(ninja); - suitableEnemies.add(zombie); - suitableEnemies.add(goblin); - suitableEnemies.add(ghost); - suitableEnemies.add(giantAnt); - - assertTrue(suitableEnemies.contains(Enemy.get())); - - Xp.setLevel(15); - - suitableEnemies = new ArrayList(); - - suitableEnemies.add(darkElf); - suitableEnemies.add(giantSpider); - suitableEnemies.add(ghost); - suitableEnemies.add(barbarian); - suitableEnemies.add(evilUnicorn); - suitableEnemies.add(ogre); - - Enemy.findEnemy(); - - assertTrue(Enemy.get() instanceof Enemy); - - assertTrue(suitableEnemies.contains(Enemy.get())); - } - - @Test - public void testGetEnemies() { - assertEquals(Enemy.arrayEnemy, Enemy.getEnemies()); - assertEquals(Enemy.arrayEnemy.get(0), Enemy.getEnemies().get(0)); - assertEquals(Enemy.arrayEnemy.get(1), Enemy.getEnemies().get(1)); - assertEquals(Enemy.arrayEnemy.get(2), Enemy.getEnemies().get(2)); - assertEquals(Enemy.arrayEnemy.get(3), Enemy.getEnemies().get(3)); - assertEquals(Enemy.arrayEnemy.get(4), Enemy.getEnemies().get(4)); - assertEquals(Enemy.arrayEnemy.get(5), Enemy.getEnemies().get(5)); - assertEquals(Enemy.arrayEnemy.get(6), Enemy.getEnemies().get(6)); - assertEquals(Enemy.arrayEnemy.get(7), Enemy.getEnemies().get(7)); - assertEquals(Enemy.arrayEnemy.get(8), Enemy.getEnemies().get(8)); - assertEquals(Enemy.arrayEnemy.get(9), Enemy.getEnemies().get(9)); - } -} diff --git a/src/com/hotmail/kalebmarc/textfighter/main/FoodTest.java b/src/com/hotmail/kalebmarc/textfighter/main/FoodTest.java deleted file mode 100644 index d496d96b..00000000 --- a/src/com/hotmail/kalebmarc/textfighter/main/FoodTest.java +++ /dev/null @@ -1,90 +0,0 @@ -package com.hotmail.kalebmarc.textfighter.main; - -import static org.junit.Assert.*; -import static org.mockito.Mockito.when; - -import java.io.ByteArrayInputStream; -import java.io.InputStream; - -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; - -import com.hotmail.kalebmarc.textfighter.player.Health; - - -/*import org.easymock.EasyMock; -import org.junit.runner.RunWith; -import org.powermock.api.easymock.PowerMock; -import org.powermock.api.mockito.PowerMockito; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; - -@RunWith(PowerMockRunner.class) -@PrepareForTest(Food.class)*/ -public class FoodTest { - - static InputStream sysInBackup; - - public static Food apple; - public static Food orange; - public static Food dragonfruit; - public static Food meat; - public static Food mushroom; - public static Food fish; - - @BeforeClass - public static void setUpBeforeClass() throws Exception { - apple = new Food("Apple", "A boring 'ol apple.", StatusEffect.type.HEALTH, Food.type.FRUIT, 5); - orange = new Food("Orange", "Sort of like an apple, but orange.", StatusEffect.type.HEALTH, Food.type.FRUIT, 5); - dragonfruit = new Food("Dragon Fruit", "Unfortunately, not a real dragon.", StatusEffect.type.HEALTH, Food.type.FRUIT, 10); - meat = new Food("Chunk of meat", "Probably not rotten.", StatusEffect.type.HEALTH, Food.type.MEAT_OTHER, 15); - mushroom = new Food("Mushroom", "The good kind!", StatusEffect.type.HEALTH, Food.type.OTHER, 5); - fish = new Food("Fish", "Found in rivers and lakes.", StatusEffect.type.HEALTH, Food.type.MEAT_FISH, 15); - } - - @AfterClass - public static void tearDownAfterClass() throws Exception { - } - - @Before - public void setUp() throws Exception { - - sysInBackup = System.in; // backup System.in to restore it later - } - - @After - public void tearDown() throws Exception { - } - - @Test - public void testList() { - Health.set(50, 100); - - //PowerMockito.mockStatic(Ui.class); - //when(Ui.getValidInt()).thenReturn(1); - - ByteArrayInputStream chooseIn = new ByteArrayInputStream("1".getBytes()); - - System.setIn(chooseIn); - - Food.list(); - - System.setIn(sysInBackup); - - assertEquals(Health.get(), 55); - } - - @Test - public void testGetFoods() { - assertEquals(Food.arrayFood, Food.getFoods()); - assertEquals(Food.arrayFood.get(0), Food.getFoods().get(0)); - assertEquals(Food.arrayFood.get(1), Food.getFoods().get(1)); - assertEquals(Food.arrayFood.get(2), Food.getFoods().get(2)); - assertEquals(Food.arrayFood.get(3), Food.getFoods().get(3)); - assertEquals(Food.arrayFood.get(4), Food.getFoods().get(4)); - assertEquals(Food.arrayFood.get(5), Food.getFoods().get(5)); - } -} diff --git a/src/com/hotmail/kalebmarc/textfighter/main/WeaponTest.java b/src/com/hotmail/kalebmarc/textfighter/main/WeaponTest.java deleted file mode 100644 index cf8d3f09..00000000 --- a/src/com/hotmail/kalebmarc/textfighter/main/WeaponTest.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.hotmail.kalebmarc.textfighter.main; - -import static org.junit.Assert.*; - -import java.io.ByteArrayInputStream; -import java.io.InputStream; - -import static org.junit.Assert.*; - -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; - -public class WeaponTest { - - static InputStream sysInBackup; - - static Weapon fists; - static Weapon baseballBat; - static Weapon knife; - static Weapon pipe; - //Guns: - static Weapon pistol; - static Weapon smg; - static Weapon shotgun; - static Weapon rifle; - static Weapon sniper; - - - @BeforeClass - public static void setUpBeforeClass() throws Exception { - fists = new Weapon("Fists", true, false, 0, 0, 5, 10, true, false); - baseballBat = new Weapon("Baseball Bat", false, true, 120, 1, 10, 15, true, false); - knife = new Weapon("Knife", false, true, 125, 2, 10, 20, true, false); - pipe = new Weapon("Pipe", false, false, 0, 0, 5, 20, true, false); - //Guns: - pistol = new Weapon("Pistol", 1, 18, true, 250, 1, 4, 15, 1.5, 3, 4, true, false); - smg = new Weapon("Smg", 10, 75, true, 700, 1, 10, 75, 2.5, 4, 6, true, false); - shotgun = new Weapon("Shotgun", 1, 12, true, 375, 2, 9, 60, 2, 5, 7, true, false); - rifle = new Weapon("Rifle", 1, 18, true, 275, 1, 5, 10, 1.25, 6, 7, true, false); - sniper = new Weapon("Sniper", 1, 10, true, 700, 2, 7, 0, 1, 7, 10, true, false); - - Weapon.arrayWeapon.get(1).owns = true; - Weapon.arrayWeapon.get(4).owns = true; - } - - @AfterClass - public static void tearDownAfterClass() throws Exception { - } - - @Before - public void setUp() throws Exception { - sysInBackup = System.in; // backup System.in to restore it later - } - - @After - public void tearDown() throws Exception { - } - - @Test - public void testChoose() { - - ByteArrayInputStream chooseIn = new ByteArrayInputStream("3".getBytes()); - - System.setIn(chooseIn); - - Weapon.choose(); - - System.setIn(sysInBackup); - - assertEquals("Pistol", Weapon.get().getName()); - } - - @Test - public void testGetWeapons() { - assertEquals(Weapon.arrayWeapon, Weapon.getWeapons()); - assertEquals(Weapon.arrayWeapon.get(0), Weapon.getWeapons().get(0)); - assertEquals(Weapon.arrayWeapon.get(1), Weapon.getWeapons().get(1)); - assertEquals(Weapon.arrayWeapon.get(2), Weapon.getWeapons().get(2)); - assertEquals(Weapon.arrayWeapon.get(3), Weapon.getWeapons().get(3)); - assertEquals(Weapon.arrayWeapon.get(4), Weapon.getWeapons().get(4)); - assertEquals(Weapon.arrayWeapon.get(5), Weapon.getWeapons().get(5)); - assertEquals(Weapon.arrayWeapon.get(6), Weapon.getWeapons().get(6)); - assertEquals(Weapon.arrayWeapon.get(7), Weapon.getWeapons().get(7)); - assertEquals(Weapon.arrayWeapon.get(8), Weapon.getWeapons().get(8)); - } -}