|
@ -0,0 +1,36 @@ |
|
|
|
|
|
import static org.assertj.core.api.Assertions.*; |
|
|
|
|
|
|
|
|
|
|
|
import org.junit.jupiter.api.BeforeEach; |
|
|
|
|
|
import org.junit.jupiter.api.Test; |
|
|
|
|
|
|
|
|
|
|
|
public class GameboardTest { |
|
|
|
|
|
|
|
|
|
|
|
private Gameboard gb; |
|
|
|
|
|
|
|
|
|
|
|
@BeforeEach |
|
|
|
|
|
void setup() { |
|
|
|
|
|
gb = new Gameboard(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
void checkGameboardSize() { |
|
|
|
|
|
String expectedResult = "11, 11"; |
|
|
|
|
|
String currentResult = "" + gb.board.length + ", " + gb.board[0].length; |
|
|
|
|
|
|
|
|
|
|
|
assertThat(currentResult).describedAs("Dimensions").isEqualTo(expectedResult); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
void checkGameboardFilled() { |
|
|
|
|
|
int[][] expectedGameboard = new int[11][11]; |
|
|
|
|
|
for(int i = 0; i < expectedGameboard.length; i++) { |
|
|
|
|
|
for(int j = 0; j < expectedGameboard[0].length; j++) { |
|
|
|
|
|
expectedGameboard[i][j] = 0; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
int [][] givenGameboard = gb.board; |
|
|
|
|
|
|
|
|
|
|
|
assertThat(givenGameboard).describedAs("Initial Gameboard").isEqualTo(expectedGameboard); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |