Connect-Four/test/GridTest.java

35 lines
897 B
Java
Raw Normal View History

2018-04-16 13:40:41 +02:00
import static org.junit.Assert.*;
import board.Grid;
import objects.Empty;
import objects.GameObject;
import objects.Player;
import objects.Token;
import org.junit.Test;
import java.awt.*;
public class GridTest {
@Test
public void gridWidthTest() {
GameObject empty = new Empty();
Grid<GameObject> grid = new Grid<>(10, 11, empty);
assertEquals(10, grid.getWidth());
}
@Test
public void gridHeightTest() {
GameObject empty = new Empty();
Grid<GameObject> grid = new Grid<>(10, 11, empty);
assertEquals(11, grid.getHeight());
}
@Test
public void gridSetGetTest() {
GameObject empty = new Empty();
Grid<GameObject> grid = new Grid<>(10, 11, empty);
Token token = new Token(new Player("Naem", Color.green));
grid.set(7, 3, token);
assertEquals(token, grid.get(7, 3));
}}