Newer
Older
maze / test / net / curtlewis / maze / grid / CellTest.java
@soloclouddeveloper soloclouddeveloper on 2 Feb 778 bytes initial commit
package net.curtlewis.maze.grid;

import static org.junit.Assert.*;

import java.util.List;

import org.junit.Test;

public class CellTest {

    @Test
    public void testCellConstructor() {
        Cell cell = new Cell(1, 2);
        assertEquals(1, cell.getRow());
        assertEquals(2, cell.getCol());
    }

    @Test
    public void testCellLinks() {
        Cell cell1 = new Cell(1, 1);
        Cell cell2 = new Cell(0, 1);
        Cell cell3 = new Cell(3,3);
        cell1.link(cell2, true);

        assertTrue(cell1.hasLink(cell2));
        assertTrue(cell2.hasLink(cell1));

        assertFalse(cell1.hasLink(cell3));
        assertFalse(cell2.hasLink(cell3));

        List<Cell> cell3Links = cell3.getLinks();
        assertEquals(0, cell3Links.size());
    }

}