### Question:
RandomMinesGenerator implements MinesGenerator { public List<Mine> get(int count, Field board) { freeCells = board.getFreeCells(); removeSafeAreaFromFreeCells(); List<Mine> result = new ArrayList<Mine>(); for (int index = 0; index < count; index++) { Mine mine = new Mine(getRandomFreeCellOnBoard()); mine.init(board); result.add(mine); freeCells.remove(mine); } return result; } RandomMinesGenerator(Dice dice); List<Mine> get(int count, Field board); static int SAFE_AREA_X_0; static int SAFE_AREA_X_1; static int SAFE_AREA_Y_0; static int SAFE_AREA_Y_1; }### Answer:
@Test public void hasOnlyOneMineAtSamePlace() { for (int index = 0; index < 100; index++) { List<Mine> mines = generate(); for (int i = 0; i < mines.size() - 1; i++) { Mine first = mines.get(i); for (int j = i + 1; j < mines.size(); j++) { Mine second = mines.get(j); if (first.getX() == second.getX() && first.getY() == second.getY()) { System.out.println(Arrays.toString(mines.toArray())); System.out.println("[" + first.getX() + "," + first.getY() + "] repeats"); fail(); } } } } }