- BufferedImage dark = images.get(SQUARE_DARK);
- BufferedImage light = images.get(SQUARE_LIGHT);
- return (dark != null && light != null)
- ? SquarePair.create(dark, light)
- : null; // todo: ImageException
+ BufferedImage board = images.get(BOARD);
+ SquarePair<BufferedImage> squarePair = SquarePair.create(
+ images.get(SQUARE_DARK), images.get(SQUARE_LIGHT)
+ );
+ if (board == null && !squarePair.isFilled()) {
+ throw new ImageException("image.incomplete.board.set", boardPath);
+ }
+ return board != null
+ ? Board.create(board)
+ : Board.create(squarePair);