Skip to content
Permalink
be175f0a35
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
63 lines (48 sloc) 1.55 KB
import junit.framework.TestCase;
public class MinonTests extends TestCase{
private static int[][] nodes;
private static final int NUM = 6;
private MinionMock testMinion;
protected void setUp()throws Exception{
nodes = new int[NUM][2];//setting up nodes for the map
nodes[0][0] = 1;
nodes[0][1] = 3;
nodes[1][0] = 16;
nodes[1][1] = 3;
nodes[2][0] = 16;
nodes[2][1] = 9;
nodes[3][0] = 4;
nodes[3][1] = 9;
nodes[4][0] = 4;
nodes[4][1] = 15;
nodes[5][0] = 18;
nodes[5][1] = 15;
MockGui mg = new MockGui(640,640,32, NUM, nodes);
StatGui sg= new StatGui(0,0);
MapTowerDefense map = new MapTowerDefense(100, NUM, nodes, mg, sg);
testMinion= new MinionMock(MinionTypes.BASIC, map);
}
public void testInitialLocation() throws Exception{
System.out.println("X= "+testMinion.getX() + " Y= "+testMinion.getY());
assertEquals(testMinion.getX(),32);
assertEquals(testMinion.getY(),96);
}
public void testHealth() throws Exception{
assertEquals(testMinion.getHealth(),255);
}
public void testDamage() throws Exception{
testMinion.minionTakeHit(20);
assertEquals(testMinion.getHealth(),235);
}
public void testMinionType() throws Exception{
System.out.println(testMinion.getName());
assertEquals(testMinion.getName(), "BASIC");
}
public void testAlive() throws Exception{
assertTrue(testMinion.isAlive());
}
public void testNotAlive() throws Exception{
testMinion.minionTakeHit(testMinion.getHealth());
assertFalse(testMinion.isAlive());
}
}