SimpleBoardMiner implements IBoardMiner { @Override public void mine(IBoard board, int bombs, IField firstField) { Point dimension = board.getDimension(); if (bombs >= dimension.x * dimension.y - 1) setAllOthersBombs(board, (Field) firstField, dimension); else setBombsRandomly(board, bombs, (Field) firstField, dimension); }  @Override void mine(IBoard board, int bombs, IField firstField);  }
@Test public void testMine() { Board board = new Board(5, 5); int bombs = 10; new SimpleBoardMiner().mine(board, bombs, (Field) board.getField(1, 1)); assertEquals(bombs, countBombs(board)); assertEquals(false, board.getField(1, 1).isBomb()); }
@Test public void testTooManyBombs() { Board board = new Board(5, 5); int bombs = 25; new SimpleBoardMiner().mine(board, bombs, (Field) board.getField(1, 1)); assertEquals(24, countBombs(board)); assertEquals(false, board.getField(1, 1).isBomb()); }