monkey-island/test/fr/eseo/game/test/model/IslandTest.java
@Test
	public void testGetRandomAdjacentCell() throws Exception {
		List<Cell> cells = new ArrayList<>();

		Cell center = this.island.getCell(ROW_CELL + 1, COLUMN_CELL + 1);
		Cell up = this.island.getCell(ROW_CELL, COLUMN_CELL + 1);
		Cell right = this.island.getCell(ROW_CELL + 1, COLUMN_CELL + 2);
		Cell down = this.island.getCell(ROW_CELL + 2, COLUMN_CELL + 1);
		Cell left = this.island.getCell(ROW_CELL + 1, COLUMN_CELL);

		for (int i = 0; i < NB_RANDOM_TEST; i++) {
			cells.add(this.island.getRandomAdjacentCell(center));
		}

		assertEquals(Collections.frequency(cells, up), NB_RANDOM_TEST / NB_MOVE_POSSIBILITIES, DELTA_RANDOM_TEST);
		assertEquals(Collections.frequency(cells, right), NB_RANDOM_TEST / NB_MOVE_POSSIBILITIES, DELTA_RANDOM_TEST);
		assertEquals(Collections.frequency(cells, down), NB_RANDOM_TEST / NB_MOVE_POSSIBILITIES, DELTA_RANDOM_TEST);
		assertEquals(Collections.frequency(cells, left), NB_RANDOM_TEST / NB_MOVE_POSSIBILITIES, DELTA_RANDOM_TEST);
	}
/**
	 * Test the occurrence of cells for getRandomAdjacentCell.
	 * 
	 * @throws java.lang.Exception
	 *             toute exception.
	 */
Test the occurrence of cells for getRandomAdjacentCell.


Test the occurrence of cells for getRandomAdjacentCell .
@Test
	public void testGetRandomAdjacentCell() throws Exception {
		List<Cell> cells = new ArrayList<>();
		Cell center = this.island.getCell(ROW_CELL + 1, COLUMN_CELL + 1);
		Cell up = this.island.getCell(ROW_CELL, COLUMN_CELL + 1);
		Cell right = this.island.getCell(ROW_CELL + 1, COLUMN_CELL + 2);
		Cell down = this.island.getCell(ROW_CELL + 2, COLUMN_CELL + 1);
		Cell left = this.island.getCell(ROW_CELL + 1, COLUMN_CELL);
		for (int i = 0; i < NB_RANDOM_TEST; i++) {
			cells.add(this.island.getRandomAdjacentCell(center));
		}
		assertEquals(Collections.frequency(cells, up), NB_RANDOM_TEST / NB_MOVE_POSSIBILITIES, DELTA_RANDOM_TEST);
		assertEquals(Collections.frequency(cells, right), NB_RANDOM_TEST / NB_MOVE_POSSIBILITIES, DELTA_RANDOM_TEST);
		assertEquals(Collections.frequency(cells, down), NB_RANDOM_TEST / NB_MOVE_POSSIBILITIES, DELTA_RANDOM_TEST);
		assertEquals(Collections.frequency(cells, left), NB_RANDOM_TEST / NB_MOVE_POSSIBILITIES, DELTA_RANDOM_TEST);
	}
@ Test public void testGetRandomAdjacentCell ( ) throws Exception { List < Cell > cells = new ArrayList < > ( ) ; Cell center = this . island . getCell ( ROW_CELL + 1 , COLUMN_CELL + 1 ) ; Cell up = this . island . getCell ( ROW_CELL , COLUMN_CELL + 1 ) ; Cell right = this . island . getCell ( ROW_CELL + 1 , COLUMN_CELL + 2 ) ; Cell down = this . island . getCell ( ROW_CELL + 2 , COLUMN_CELL + 1 ) ; Cell left = this . island . getCell ( ROW_CELL + 1 , COLUMN_CELL ) ; for ( int i = 0 ; i < NB_RANDOM_TEST ; i ++ ) { cells . add ( this . island . getRandomAdjacentCell ( center ) ) ; } assertEquals ( Collections . frequency ( cells , up ) , NB_RANDOM_TEST / NB_MOVE_POSSIBILITIES , DELTA_RANDOM_TEST ) ; assertEquals ( Collections . frequency ( cells , right ) , NB_RANDOM_TEST / NB_MOVE_POSSIBILITIES , DELTA_RANDOM_TEST ) ; assertEquals ( Collections . frequency ( cells , down ) , NB_RANDOM_TEST / NB_MOVE_POSSIBILITIES , DELTA_RANDOM_TEST ) ; assertEquals ( Collections . frequency ( cells , left ) , NB_RANDOM_TEST / NB_MOVE_POSSIBILITIES , DELTA_RANDOM_TEST ) ; }
Test the occurrence of cells for getRandomAdjacentCell.
Test the occurrence of cells for getRandomAdjacentCell .