Board implements IBoard { static Board createFromState(final BoardState state) { return new Board(state); } 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 testCreateFromState() { bomb(1, 1).setFlagged(true); open(0, 0); BoardState state = itsBoard.getState(); Board board = Board.createFromState(state); assertEquals(itsBoard.getDimension(), board.getDimension()); assertEquals(true, board.getField(1, 1).isBomb()); assertEquals(true, board.getField(0, 0).isOpen()); assertEquals(true, board.getField(1, 1).isFlagged()); assertEquals(false, board.getField(0, 1).isOpen()); }