diff --git a/build.gradle b/build.gradle index 34c147c591dbd234716989b1853fc32d4de0f2d8..143c7ac12820e11ad49ba41ad2faa5a9f72926fd 100644 --- a/build.gradle +++ b/build.gradle @@ -13,9 +13,9 @@ repositories { } dependencies { - testImplementation('org.junit.jupiter:junit-jupiter-api:5.7.2', - 'org.hamcrest:hamcrest-library:2.2', 'net.obvj:junit-utils:1.3.1') - testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.2' + testImplementation('org.junit.jupiter:junit-jupiter-api:5.8.0', + 'org.assertj:assertj-core:3.20.2') + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.0' } test { diff --git a/src/main/java/model/Grid.java b/src/main/java/model/Grid.java index 0118e34dfb99646497c77c71cf93a10d2109d03f..a773b4e39719b661c37abca0d35157864eb231b2 100644 --- a/src/main/java/model/Grid.java +++ b/src/main/java/model/Grid.java @@ -90,12 +90,12 @@ public class Grid implements Iterable<Cell> { // TODO: Écrire une version correcte de cette méthode. - public List<Cell> getNeighbours(int rowIndex, int columnIndex) { + public List<Cell> getNeighbors(int rowIndex, int columnIndex) { return null; } // TODO: Écrire une version correcte de cette méthode. - public int countAliveNeighbours(int rowIndex, int columnIndex) { + public int countAliveNeighbors(int rowIndex, int columnIndex) { return 0; } diff --git a/src/test/java/model/GridTest.java b/src/test/java/model/GridTest.java index a2956612e6cd8c13ead11e6e77623b957964c994..bf3637238f83b04cd794f6176f454aa0c2c4579b 100644 --- a/src/test/java/model/GridTest.java +++ b/src/test/java/model/GridTest.java @@ -2,8 +2,8 @@ package model; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.*; + +import static org.assertj.core.api.Assertions.assertThat; public class GridTest { private Grid grid; @@ -14,27 +14,25 @@ public class GridTest { } @Test - public void testGetNeighbours(){ - assertThat(grid.getNeighbours(1,1), is(notNullValue())); - assertThat(grid.getNeighbours(1,1), hasSize(equalTo(8))); - assertThat(grid.getNeighbours(1,1), - containsInAnyOrder(grid.getCell(0,0), + public void testGetNeighbors(){ + assertThat(grid.getNeighbors(1,1)).isNotNull(); + assertThat(grid.getNeighbors(1,1)).hasSize(8); + assertThat(grid.getNeighbors(1,1)) + .containsExactlyInAnyOrder(grid.getCell(0,0), grid.getCell(0,1), grid.getCell(0,2), grid.getCell(1,0), grid.getCell(1,2), grid.getCell(2,0), grid.getCell(2,1), - grid.getCell(2,2))); + grid.getCell(2,2)); } @Test - public void testCountAliveNeighbours(){ - assertThat(grid.countAliveNeighbours(1,1), is(equalTo(0))); + public void testCountAliveNeighbors(){ + assertThat(grid.countAliveNeighbors(1,1)).isEqualTo(0); grid.getCell(2,2).setState(CellState.ALIVE); grid.getCell(0,0).setState(CellState.ALIVE); - assertThat(grid.countAliveNeighbours(1,1), is(equalTo(2))); + assertThat(grid.countAliveNeighbors(1,1)).isEqualTo(2); } - - }