-
Notifications
You must be signed in to change notification settings - Fork 0
Testing codes
package RebirthofLegends;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;
public class HeroTest {
public HeroTest() {
}
@BeforeClass
public static void setUpClass() throws Exception {
}
@AfterClass
public static void tearDownClass() throws Exception {
}
/**
* Test of doDamage method, of class Hero.
*/
@Test
public void testDoDamage() {
double d = 0.0;
Hero instance = new Hero();
int expResult = 0;
int result = instance.doDamage(d);
assertEquals(expResult, result);
}
/**
* Test of takeDamage method, of class Hero.
*/
@Test
public void testTakeDamage() {
int n = 45;
Hero instance = new Hero();
instance.takeDamage(n);
assertEquals(55,instance.getHealth());
}
/**
* Test of setName method, of class Hero.
*/
@Test
public void testSetName() {
String n = "Alley";
Hero instance = new Hero();
instance.setName(n);
assertEquals(n,instance.getName());
}
/**
* Test of setGender method, of class Hero.
*/
@Test
public void testSetGender() {
String g = "Female";
Hero instance = new Hero();
instance.setGender(g);
assertEquals(g,instance.getGender());
}
/**
* Test of setElement method, of class Hero.
*/
@Test
public void testSetElement() {
String e = "Wind";
Hero instance = new Hero();
instance.setElement(e);
assertEquals(e,instance.getElement());
}
/**
* Test of deadCheck method, of class Hero.
*/
@Test
public void testDeadCheck() {
Hero instance = new Hero();
boolean expResult = false;
boolean result = instance.deadCheck();
assertEquals(expResult, result);
}
/**
* Test of heal method, of class Hero.
*/
@Test
public void testHeal() {
Hero instance = new Hero();
instance.heal();
assertEquals(100,instance.getHealth());
}
/**
* Test of takemymoney method, of class Hero.
*/
@Test
public void testTakemymoney() {
int a = 3;
Hero instance = new Hero(30,100,"Name","Element","Gender",5,12);
instance.takemymoney(a);
assertEquals(2,instance.getCrystals());
}
/**
* Test of incMaxHP method, of class Hero.
*/
@Test
public void testIncMaxHP() {
Hero instance = new Hero(30,100,"Name","Element","Gender",5,12);;
instance.incMaxHP();
assertEquals(50,instance.getHealth());
assertEquals(120,instance.getMaxHealth());
}
/**
* Test of win method, of class Hero.
*/
@Test
public void testWin_0args() {
int exp = 6;
Hero instance = new Hero(30,100,"Name","Element","Gender",5,12);
instance.win();
assertEquals(exp,instance.getCrystals());
}
/**
* Test of win method, of class Hero.
*/
@Test
public void testWin_int() {
int a = 5;
int exp = 10;
Hero instance = new Hero(30,100,"Name","Element","Gender",5,12);
instance.win(a);
assertEquals(exp,instance.getCrystals());
}
/**
* Test of getAwesome method, of class Hero.
*/
@Test
public void testGetAwesome() {
Hero instance = new Hero();
Weapon expResult = null;
Weapon result = instance.getAwesome();
assertEquals(expResult, result);
}
/**
* Test of setAwesome method, of class Hero.
*/
@Test
public void testSetAwesome() {
Weapon awesome = null;
Hero instance = new Hero();
instance.setAwesome(awesome);
assertEquals(awesome,instance.getAwesome());
}
/**
* Test of getName method, of class Hero.
*/
@Test
public void testGetName() {
Hero instance = new Hero();
String expResult = "tom";
String result = instance.getName();
assertEquals(expResult, result);
}
/**
* Test of getElement method, of class Hero.
*/
@Test
public void testGetElement() {
Hero instance = new Hero();
String expResult = "fire";
String result = instance.getElement();
assertEquals(expResult, result);
}
/**
* Test of getGender method, of class Hero.
*/
@Test
public void testGetGender() {
Hero instance = new Hero();
String expResult = "male";
String result = instance.getGender();
assertEquals(expResult, result);
}
/**
* Test of setHealth method, of class Hero.
*/
@Test
public void testSetHealth() {
int health = 50;
Hero instance = new Hero();
instance.setHealth(health);
assertEquals(health,instance.getHealth());
}
/**
* Test of getHealth method, of class Hero.
*/
@Test
public void testGetHealth() {
Hero instance = new Hero();
int expResult = 100;
int result = instance.getHealth();
assertEquals(expResult, result);
;
}
/**
* Test of getCrystals method, of class Hero.
*/
@Test
public void testGetCrystals() {
Hero instance = new Hero(30,100,"Name","Element","Gender",5,12);
int expResult = 5;
int result = instance.getCrystals();
assertEquals(expResult, result);
;
}
/**
* Test of setCrystals method, of class Hero.
*/
@Test
public void testSetCrystals() {
int crystals = 10;
Hero instance = new Hero();
instance.setCrystals(crystals);
assertEquals(crystals,instance.getCrystals());
}
/**
* Test of getMaxCrystals method, of class Hero.
*/
@Test
public void testGetMaxCrystals() {
Hero instance = new Hero(30,100,"Name","Element","Gender",5,12);
int expResult = 12;
int result = instance.getMaxCrystals();
assertEquals(expResult, result);
}
/**
* Test of setMaxCrystals method, of class Hero.
*/
@Test
public void testSetMaxCrystals() {
int maxCrystals = 20;
Hero instance = new Hero();
instance.setMaxCrystals(maxCrystals);
assertEquals(maxCrystals,instance.getMaxCrystals());
}
/**
* Test of getMaxHealth method, of class Hero.
*/
@Test
public void testGetMaxHealth() {
Hero instance = new Hero(30,100,"Name","Element","Gender",5,12);
int expResult = 100;
int result = instance.getMaxHealth();
assertEquals(expResult, result);
}
/**
* Test of setMaxHealth method, of class Hero.
*/
@Test
public void testSetMaxHealth() {
int maxHealth = 100;
Hero instance = new Hero();
instance.setMaxHealth(maxHealth);
int result = instance.getMaxHealth();
assertEquals(maxHealth, result);
}
}
package RebirthofLegends;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;
public class MonsterTest {
public MonsterTest() {
}
@BeforeClass
public static void setUpClass() throws Exception {
}
@AfterClass
public static void tearDownClass() throws Exception {
}
/**
* Test of getLevel method, of class Monster.
*/
@Test
public void testGetLevel() {
;
Monster instance = new Monster();
int expResult = 1;
int result = instance.getLevel();
assertEquals(expResult, result);
}
/**
* Test of setLevel method, of class Monster.
*/
@Test
public void testSetLevel() {
int level = 5;
Monster instance = new Monster();
instance.setLevel(level);
int result = instance.getLevel();
assertEquals(level, result);
}
/**
* Test of getMaxHP method, of class Monster.
*/
@Test
public void testGetMaxHP() {
Monster instance = new Monster();
int expResult = 10;
int result = instance.getMaxHP();
assertEquals(expResult, result);
}
/**
* Test of setMaxHP method, of class Monster.
*/
@Test
public void testSetMaxHP() {
int maxHP = 100;
Monster instance = new Monster();
instance.setMaxHP(maxHP);
int result = instance.getMaxHP();
assertEquals(maxHP, result);
}
/**
* Test of setStats method, of class Monster.
*/
@Test
public void testSetStats() {
int a = 2;
int expResult = 20;
int exp = 5;
Monster instance = new Monster();
instance.setStats(a);
int result = instance.getHealth();
assertEquals(expResult, result);
int res = instance.doDamage();
assertEquals(exp, res);
}
/**
* Test of getHealth method, of class Monster.
*/
@Test
public void testGetHealth() {
Monster instance = new Monster();
int expResult = 10;
int result = instance.getHealth();
assertEquals(expResult, result);
}
/**
* Test of takeDamage method, of class Monster.
*/
@Test
public void testTakeDamage() {
int n = 4;
int expResult = 6;
Monster instance = new Monster();
instance.takeDamage(n);
int result = instance.getHealth();
assertEquals(expResult, result);
}
/**
* Test of deadCheck method, of class Monster.
*/
@Test
public void testDeadCheck() {
Monster instance = new Monster();
boolean expResult = false;
boolean result = instance.deadCheck();
assertEquals(expResult, result);
}
/**
* Test of doDamage method, of class Monster.
*/
@Test
public void testDoDamage() {
Monster instance = new Monster();
int expResult = 5;
int result = instance.doDamage();
assertEquals(expResult, result);
}
}
package RebirthofLegends;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;
public class BattleTest {
public BattleTest() {
}
@BeforeClass
public static void setUpClass() throws Exception {
}
@AfterClass
public static void tearDownClass() throws Exception {
}
/**
* Test of Battle method, of class Battle.
*/
@Test
public void testBattle() {
String n = "";
Hero h = null;
Monster m = null;
String r = "";
Battle instance = new Battle();
HeroMonster expResult = null;
HeroMonster result = instance.Battle(n, h, m, r);
assertEquals(expResult, result);
}
/**
* Test of typeTheWord method, of class Battle.
*/
@Test
public void testTypeTheWord() {
Battle instance = new Battle();
String expResult = null;
String result = instance.typeTheWord();
assertEquals(expResult, result);
}
/**
* Test of heroMonsterFight method, of class Battle.
*/
@Test
public void testHeroMonsterFight() {
String actual = "";
String entered = "";
Battle instance = new Battle();
instance.heroMonsterFight(actual, entered);
}
/**
* Test of returnMonster method, of class Battle.
*/
@Test
public void testReturnMonster() {
Battle instance = new Battle();
Monster expResult = null;
instance.setMonster(expResult);
assertEquals(expResult, instance.returnMonster());
}
/**
* Test of returnHero method, of class Battle.
*/
@Test
public void testReturnHero() {
Battle instance = new Battle();
Hero expResult = null;
instance.setHero(expResult);
assertEquals(expResult, instance.returnHero());
}
/**
* Test of charCompare method, of class Battle.
*/
@Test
public void testCharCompare() {
String actual = "Alley";
String entered = "Alleluya";
Battle instance = new Battle();
double expResult = 0.5;
double result = instance.charCompare(actual, entered);
assertEquals(expResult, result,0.0);
}
}
package RebirthofLegends;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;
public class HeroMonsterTest {
public HeroMonsterTest() {
}
@BeforeClass
public static void setUpClass() throws Exception {
}
@AfterClass
public static void tearDownClass() throws Exception {
}
/**
* Test of returnHero method, of class HeroMonster.
*/
@Test
public void testReturnHero() {
HeroMonster instance = new HeroMonster(null,null);
Hero expResult = null;
assertEquals(expResult, instance.returnHero());
}
/**
* Test of returnMonster method, of class HeroMonster.
*/
@Test
public void testReturnMonster() {
HeroMonster instance = new HeroMonster(null,null);
Monster expResult = null;
assertEquals(expResult, instance.returnMonster());
}
}
package RebirthofLegends;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;
public class SavingTest {
public SavingTest() {
}
@BeforeClass
public static void setUpClass() throws Exception {
}
@AfterClass
public static void tearDownClass() throws Exception {
}
/**
* Test of setHP method, of class Saving.
*/
@Test
public void testSetHP() {
int expResult = 25;
Saving instance = new Saving();
instance.setHP(expResult);
int result = instance.getHP();
assertEquals(expResult, result);
}
/**
* Test of setMaxHP method, of class Saving.
*/
@Test
public void testSetMaxHP() {
int expResult = 125;
Saving instance = new Saving();
instance.setMaxHP(expResult);
int result = instance.getMaxHP();
assertEquals(expResult, result);
}
/**
* Test of setGender method, of class Saving.
*/
@Test
public void testSetGender() {
String g = "Male";
Saving instance = new Saving();
instance.setGender(g);
String result = instance.getGender();
assertEquals(g, result);
}
/**
* Test of setName method, of class Saving.
*/
@Test
public void testSetName() {
String nm = "Alleluya";
Saving instance = new Saving();
instance.setName(nm);
String result = instance.getName();
assertEquals(nm, result);
}
/**
* Test of setElement method, of class Saving.
*/
@Test
public void testSetElement() {
String elm = "Fire";
Saving instance = new Saving();
instance.setElement(elm);
String result = instance.getElement();
assertEquals(elm, result);
}
/**
* Test of setCrystal method, of class Saving.
*/
@Test
public void testSetCrystal() {
int c = 5;
Saving instance = new Saving();
instance.setCrystal(c);
int result = instance.getCrystal();
assertEquals(c, result);
}
/**
* Test of setMaxCrystal method, of class Saving.
*/
@Test
public void testSetMaxCrystal() {
int c = 100;
Saving instance = new Saving();
instance.setMaxCrystal(c);
int result = instance.getMaxCrystal();
assertEquals(c, result);
}
/**
* Test of getHP method, of class Saving.
*/
@Test
public void testGetHP() {
Saving instance = new Saving();
int expResult = 0;
int result = instance.getHP();
assertEquals(expResult, result);
}
/**
* Test of getMaxHP method, of class Saving.
*/
@Test
public void testGetMaxHP() {
Saving instance = new Saving(100,200,"Name","Element","Gender",5,99);
int expResult = 200;
int result = instance.getMaxHP();
assertEquals(expResult, result);
}
/**
* Test of getName method, of class Saving.
*/
@Test
public void testGetName() {
Saving instance = new Saving();
String expResult = "";
String result = instance.getName();
assertEquals(expResult, result);
}
/**
* Test of getGender method, of class Saving.
*/
@Test
public void testGetGender() {
Saving instance = new Saving();
String expResult = "";
String result = instance.getGender();
assertEquals(expResult, result);
}
/**
* Test of getElement method, of class Saving.
*/
@Test
public void testGetElement() {
Saving instance = new Saving();
String expResult = "";
String result = instance.getElement();
assertEquals(expResult, result);
}
/**
* Test of getCrystal method, of class Saving.
*/
@Test
public void testGetCrystal() {
Saving instance = new Saving(100,200,"Name","Element","Gender",5,99);
int expResult = 5;
int result = instance.getCrystal();
assertEquals(expResult, result);
}
/**
* Test of getMaxCrystal method, of class Saving.
*/
@Test
public void testGetMaxCrystal() {
Saving instance = new Saving(100,200,"Name","Element","Gender",5,99);
int expResult = 99;
int result = instance.getMaxCrystal();
assertEquals(expResult, result);
}
}
package RebirthofLegends;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;
public class WeaponTest {
public WeaponTest() {
}
@BeforeClass
public static void setUpClass() throws Exception {
}
@AfterClass
public static void tearDownClass() throws Exception {
}
/**
* Test of getUpgrade method, of class Weapon.
*/
@Test
public void testGetUpgrade() {
Weapon instance = new Weapon();
int expResult = 1;
int result = instance.getUpgrade();
assertEquals(expResult, result);
}
/**
* Test of setUpgrade method, of class Weapon.
*/
@Test
public void testSetUpgrade() {
int upgrade = 5;
Weapon instance = new Weapon();
instance.setUpgrade(upgrade);
assertEquals(upgrade,instance.getUpgrade());
}
/**
* Test of getWpatk method, of class Weapon.
*/
@Test
public void testGetWpatk() {
Weapon instance = new Weapon();
instance.setUpgrade(11);
int expResult = 312;
int result = instance.getWpatk();
assertEquals(expResult, result);
}
/**
* Test of setWpatk method, of class Weapon.
*/
@Test
public void testSetWpatk() {
int wpatk = 5;
Weapon instance = new Weapon();
instance.setWpatk(wpatk);
assertEquals(3,instance.getWpatk());
}
/**
* Test of setMaxUpg method, of class Weapon.
*/
@Test
public void testSetMaxUpg() {
int maxUpg = 20;
Weapon instance = new Weapon();
instance.setMaxUpgZ(maxUpg);
assertEquals(maxUpg,instance.getMaxUpg());
}
/**
* Test of getMaxUpg method, of class Weapon.
*/
@Test
public void testGetMaxUpg() {
Weapon instance = new Weapon();
int expResult = 100;
int result = instance.getMaxUpg();
assertEquals(expResult, result);
}
/**
* Test of resetWpatk method, of class Weapon.
*/
@Test
public void testResetWpatk() {
Weapon instance = new Weapon();
int expResult = 7;
int result = instance.resetWpatk();
assertEquals(expResult, result);
}
/**
* Test of resetUpg method, of class Weapon.
*/
@Test
public void testResetUpg() {
Weapon instance = new Weapon();
int expResult = 0;
int result = instance.resetUpg();
assertEquals(expResult, result);
}
/**
* Test of wepCheck method, of class Weapon.
*/
@Test
public void testWepCheck() {
Weapon instance = new Weapon();
int expResult = 0;
int result = instance.wepCheck();
assertEquals(expResult, result);
instance.setMaxUpgZ(150);
int exp = 7;
int res = instance.wepCheck();
assertEquals(exp, res);
}
/**
* Test of cToUpg method, of class Weapon.
*/
@Test
public void testCToUpg() {
Weapon instance = new Weapon();
int expResult = 2;
int result = instance.cToUpg();
assertEquals(expResult, result);
}
/**
* Test of upgrade method, of class Weapon.
*/
@Test
public void testUpgrade() {
Weapon instance = new Weapon();
instance.upgrade();
assertEquals(2,instance.getUpgrade());
}
}