Board implements Serializable { public void setUpProblem(String[] diagram, StoneColor colorToPlay) { assert diagram.length == coords.getWidth(); clear(); for (int r = 0; r < coords.getWidth(); r++) { assert diagram[r].length() == coords.getWidth(); for (int c = 0; c < coords.getWidth(); c++) { final StoneColor color = StoneColor.forChar(diagram[r].charAt(c)); if (color != null) { placeInitialStone(color, coords.at(r, c)); } else if (NonStoneColor.forChar(diagram[r].charAt(c)) != VACANT) { throw new IllegalArgumentException(); } } } this.colorToPlay = colorToPlay; } Board(int width); void addObserver(BoardObserver observer); void clear(); void clearPreservingInitialStones(); void copyDataFrom(Board that); short getChainNextPoint(short p); short getChainRoot(short p); Color getColorAt(short p); StoneColor getColorToPlay(); CoordinateSystem getCoordinateSystem(); long getFancyHash(); long getHash(); ShortSet getLiberties(short p); int getNeighborsOfColor(short p, Color color); short getPasses(); int getTurn(); ShortSet getVacantPoints(); boolean hasMaxNeighborsForColor(StoneColor color, short p); boolean isLegal(short p); void pass(); void placeInitialStone(StoneColor color, short p); Legality play(short p); Legality play(String move); Legality playFast(short p); void setColorToPlay(StoneColor stoneColor); void setPasses(short passes); void setUpHandicap(int handicapSize); void setUpProblem(String[] diagram, StoneColor colorToPlay); @Override String toString(); void removeStones(ShortSet ourDead);  }
@Test(expected = IllegalArgumentException.class) public void testBadDiagram() { String[] example = { "..#..", "...0.", ".....", ".....", ".....", }; board.setUpProblem(example, BLACK); }