Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Game of life Template
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
YAGOUBI Rim
Game of life Template
Commits
15ab66ec
Commit
15ab66ec
authored
3 years ago
by
LABOUREL Arnaud
Browse files
Options
Downloads
Patches
Plain Diff
Passage à AssertJ
parent
08632686
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
build.gradle
+3
-3
3 additions, 3 deletions
build.gradle
src/main/java/model/Grid.java
+2
-2
2 additions, 2 deletions
src/main/java/model/Grid.java
src/test/java/model/GridTest.java
+11
-13
11 additions, 13 deletions
src/test/java/model/GridTest.java
with
16 additions
and
18 deletions
build.gradle
+
3
−
3
View file @
15ab66ec
...
...
@@ -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
{
...
...
This diff is collapsed.
Click to expand it.
src/main/java/model/Grid.java
+
2
−
2
View file @
15ab66ec
...
...
@@ -90,12 +90,12 @@ public class Grid implements Iterable<Cell> {
// TODO: Écrire une version correcte de cette méthode.
public
List
<
Cell
>
getNeighbo
u
rs
(
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
countAliveNeighbo
u
rs
(
int
rowIndex
,
int
columnIndex
)
{
public
int
countAliveNeighbors
(
int
rowIndex
,
int
columnIndex
)
{
return
0
;
}
...
...
This diff is collapsed.
Click to expand it.
src/test/java/model/GridTest.java
+
11
−
13
View file @
15ab66ec
...
...
@@ -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
testGetNeighbo
u
rs
(){
assertThat
(
grid
.
getNeighbo
u
rs
(
1
,
1
)
,
is
(
notNullValue
())
);
assertThat
(
grid
.
getNeighbo
u
rs
(
1
,
1
)
,
hasSize
(
equalTo
(
8
))
);
assertThat
(
grid
.
getNeighbo
u
rs
(
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
)
)
.
contains
Exactly
InAnyOrder
(
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
testCountAliveNeighbo
u
rs
(){
assertThat
(
grid
.
countAliveNeighbo
u
rs
(
1
,
1
)
,
is
(
e
qualTo
(
0
)
))
;
public
void
testCountAliveNeighbors
(){
assertThat
(
grid
.
countAliveNeighbors
(
1
,
1
)
).
isE
qualTo
(
0
);
grid
.
getCell
(
2
,
2
).
setState
(
CellState
.
ALIVE
);
grid
.
getCell
(
0
,
0
).
setState
(
CellState
.
ALIVE
);
assertThat
(
grid
.
countAliveNeighbo
u
rs
(
1
,
1
)
,
is
(
e
qualTo
(
2
)
))
;
assertThat
(
grid
.
countAliveNeighbors
(
1
,
1
)
).
isE
qualTo
(
2
);
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment