Skip to content
Permalink
927d9de1f6
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
65 lines (58 sloc) 1.32 KB
package tests;
import static org.junit.Assert.*;
import junit.framework.TestCase;
import model.MapTowerDefense;
import model.MinionFactory;
import org.junit.Test;
import view.MockGui;
import view.StatGui;
public class MinionFactoryTests extends TestCase {
MapTowerDefense map;
MinionFactory MF;
int[][] nodes;
int NUM;
public void setUp() {
NUM = 6;
nodes = new int[NUM][2];
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);
map = new MapTowerDefense(100, NUM, nodes, mg, sg);
MF = map.getMF();
mg.setMap(map);
sg.setMap(map);
sg.setup();
}
public void testX() {
assertEquals(1, MF.getX());
}
public void testY() {
assertEquals(3, MF.getY());
}
public void testMax() {
assertEquals(100, MF.getMax());
}
public void testID() {
assertEquals(0, MF.getNum());
}
public void testCreateMinion() {
MF.createRandominion();
assertEquals(1,MF.getNum());
}
public void testCreate2Minions() {
MF.createRandominion();
MF.createRandominion();
assertEquals(2,MF.getNum());
}
}