Skip to content
Snippets Groups Projects
Commit 518cbccb authored by Eric Bieszczad-Stie's avatar Eric Bieszczad-Stie :weary:
Browse files

More readable test code in BattleTest

parent 86655d9c
Branches
No related tags found
No related merge requests found
Pipeline #171264 failed
...@@ -6,18 +6,20 @@ import junit.framework.TestCase; ...@@ -6,18 +6,20 @@ import junit.framework.TestCase;
public class BattleTest extends TestCase { public class BattleTest extends TestCase {
public void testInitiatingBattleWorks() { public void testInitiatingBattleWorks() {
Army army1 = new Army("Test1");
Unit superBoss = new Unit("SuperBoss", 10, 10, 10000) { Unit superBoss = new Unit("SuperBoss", 10, 10, 10000) {
public int getAttackBonus() { return 0; } public int getAttackBonus() { return 0; }
public int getResistBonus() { return 100; } public int getResistBonus() { return 100; }
}; };
army1.add(superBoss);
Army army2 = new Army("Test2");
Unit weakling = new Unit("Weakling", 1, 1, 10) { Unit weakling = new Unit("Weakling", 1, 1, 10) {
public int getAttackBonus() { return 0; } public int getAttackBonus() { return 0; }
public int getResistBonus() { return 0; } public int getResistBonus() { return 0; }
}; };
Army army1 = new Army("Test1");
army1.add(superBoss);
Army army2 = new Army("Test2");
army2.add(weakling); army2.add(weakling);
try { try {
...@@ -29,18 +31,20 @@ public class BattleTest extends TestCase { ...@@ -29,18 +31,20 @@ public class BattleTest extends TestCase {
public void testSimulateEndsWithCorrectWinner() { public void testSimulateEndsWithCorrectWinner() {
Army army1 = new Army("Test1");
Unit superBoss = new Unit("SuperBoss", 10, 10, 10000) { Unit superBoss = new Unit("SuperBoss", 10, 10, 10000) {
public int getAttackBonus() { return 0; } public int getAttackBonus() { return 0; }
public int getResistBonus() { return 100; } public int getResistBonus() { return 100; }
}; };
army1.add(superBoss);
Army army2 = new Army("Test2");
Unit weakling = new Unit("Weakling", 1, 1, 10) { Unit weakling = new Unit("Weakling", 1, 1, 10) {
public int getAttackBonus() { return 0; } public int getAttackBonus() { return 0; }
public int getResistBonus() { return 0; } public int getResistBonus() { return 0; }
}; };
Army army1 = new Army("Test1");
army1.add(superBoss);
Army army2 = new Army("Test2");
army2.add(weakling); army2.add(weakling);
Battle battle = new Battle(army1, army2); Battle battle = new Battle(army1, army2);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment