Board implements IBoard { @Override public IField getField(final int x, final int y) { return itsFields[x * dimY + y]; } Board(final int dimX, final int dimY); private  Board(final BoardState state); @Override IField getField(final int x, final int y); @Override Point getDimension(); @Override int getFlagCount(); @Override int getOpenCount(); void openAllFlaggedOrBomb(); @Override String toString(); @Override Point getPosition(final IField field); @Override boolean isOverflagged(); boolean isExploded(); @Override int hashCode(); @Override boolean equals(Object obj);  }
@Test public void testGetNeighbors() { Board board = new Board(3, 3); assertNeighbors((Field) board.getField(0, 0), board, new int[][]{{1, 0}, {0, 1}, {1, 1}}); assertNeighbors((Field) board.getField(1, 0), board, new int[][]{{0, 0}, {0, 1}, {1, 1}, {2, 1}, {2, 0}}); assertNeighbors((Field) board.getField(1, 1), board, new int[][]{{0, 0}, {0, 1}, {0, 2}, {1, 2}, {2, 2}, {2, 1}, {2, 0}, {1, 0}}); }