Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
tok-chef
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Antoine HAZEBROUCK
tok-chef
Commits
85b848a9
Commit
85b848a9
authored
Sep 13, 2024
by
Antoine Hazebrouck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
concours auquels un chef a participé
parent
159fe3fa
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
14 deletions
+49
-14
FileConcours.java
src/main/java/imt/concours/FileConcours.java
+7
-0
ApplicationTest.java
src/test/java/imt/ApplicationTest.java
+8
-0
FileConcoursTest.java
src/test/java/imt/concours/FileConcoursTest.java
+34
-14
No files found.
src/main/java/imt/concours/FileConcours.java
View file @
85b848a9
...
...
@@ -41,4 +41,11 @@ public class FileConcours {
public
List
<
Concours
>
concoursTermines
()
{
return
concoursTermines
;
}
public
List
<
Concours
>
concoursAuquelAParticipe
(
Chef
chef
)
{
return
concoursTermines
().
stream
()
.
filter
(
concoursLoop
->
concoursLoop
.
getPropositions
().
stream
().
map
(
prop
->
prop
.
getChef
()).
toList
()
.
contains
(
chef
))
.
toList
();
}
}
src/test/java/imt/ApplicationTest.java
View file @
85b848a9
...
...
@@ -2,6 +2,9 @@ package imt;
import
org.junit.jupiter.api.Test
;
import
imt.personnes.Chef
;
import
imt.personnes.Genre
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertTrue
;
class
ApplicationTest
{
...
...
@@ -10,4 +13,9 @@ class ApplicationTest {
void
shouldAnswerWithTrue
()
{
assertTrue
(
true
);
}
// @Test
// void tok_chef_utilisation() {
// Chef antoine = new Chef(1, "Hazebrouck", "Antoine", "06 ...", Genre.HOMME, 0, null, null)
// }
}
src/test/java/imt/concours/FileConcoursTest.java
View file @
85b848a9
...
...
@@ -5,7 +5,11 @@ import static imt.concours.ConcoursTest.JURY_1;
import
static
imt
.
concours
.
ConcoursTest
.
JURY_2
;
import
static
imt
.
concours
.
ConcoursTest
.
JURY_3
;
import
static
imt
.
concours
.
ConcoursTest
.
PROPOSITIONS
;
import
static
imt
.
concours
.
ConcoursTest
.*;
import
static
imt
.
concours
.
ConcoursTest
.
PROPOSITION_1
;
import
static
imt
.
concours
.
ConcoursTest
.
PROPOSITION_2
;
import
static
imt
.
concours
.
ConcoursTest
.
PROPOSITION_3
;
import
static
imt
.
concours
.
ConcoursTest
.
PROPOSITION_4
;
import
static
imt
.
concours
.
ConcoursTest
.
PROPOSITION_5
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
import
java.util.HashSet
;
...
...
@@ -21,6 +25,18 @@ import imt.personnes.Genre;
import
imt.personnes.Specialite
;
public
class
FileConcoursTest
{
public
static
Concours
CONCOURS_1
()
{
return
new
Concours
(
JURY_1
,
JURY_2
,
JURY_3
,
PROPOSITIONS
);
}
public
static
Concours
CONCOURS_2
()
{
return
new
Concours
(
JURY_1
,
JURY_2
,
JURY_3
,
PROPOSITIONS
);
}
public
static
Concours
CONCOURS_3
()
{
return
new
Concours
(
JURY_1
,
JURY_2
,
JURY_3
,
PROPOSITIONS
);
}
@Test
void
fileDeConcours_tout_les_concours_du_chef
()
{
Set
<
Proposition
>
propositionsSansTelChef
=
new
HashSet
<>(
PROPOSITIONS
);
...
...
@@ -29,28 +45,23 @@ public class FileConcoursTest {
new
Proposition
(
new
Plat
(
99
,
"plat99"
,
new
Ingredient
[]
{}),
new
Chef
(
99
,
"nom99"
,
"prenom99"
,
"QSD"
,
Genre
.
HOMME
,
4
,
Specialite
.
CUISINIER
,
Set
.
of
(
new
Plat
(
99
,
"plat99"
,
new
Ingredient
[]
{})))));
Concours
concours1
=
new
Concours
(
JURY_1
,
JURY_2
,
JURY_3
,
PROPOSITIONS
);
Concours
concours2
=
new
Concours
(
JURY_1
,
JURY_2
,
JURY_3
,
propositionsSansTelChef
);
Concours
concours3
=
new
Concours
(
JURY_1
,
JURY_2
,
JURY_3
,
new
HashSet
<>(
PROPOSITIONS
));
Concours
concoursSansTelChef
=
new
Concours
(
JURY_1
,
JURY_2
,
JURY_3
,
propositionsSansTelChef
);
FileConcours
fileConcours
=
new
FileConcours
(
concours1
,
concours2
,
concours3
);
FileConcours
fileConcours
=
new
FileConcours
(
CONCOURS_1
(),
concoursSansTelChef
,
CONCOURS_3
()
);
assertThat
(
fileConcours
.
concoursAuquelParticipe
(
CHEF_1
)).
isEqualTo
(
List
.
of
(
concours1
,
concours3
));
assertThat
(
fileConcours
.
concoursAuquelParticipe
(
CHEF_1
)).
isEqualTo
(
List
.
of
(
CONCOURS_1
(),
CONCOURS_3
()
));
}
@Test
void
concours_termines
()
{
Concours
concours1
=
new
Concours
(
JURY_1
,
JURY_2
,
JURY_3
,
PROPOSITIONS
);
Concours
concours2
=
new
Concours
(
JURY_1
,
JURY_2
,
JURY_3
,
PROPOSITIONS
);
Concours
concours3
=
new
Concours
(
JURY_1
,
JURY_2
,
JURY_3
,
PROPOSITIONS
);
FileConcours
fileConcours
=
new
FileConcours
(
concours1
,
concours2
,
concours3
);
Concours
CONCOURS_1
=
CONCOURS_1
();
FileConcours
fileConcours
=
new
FileConcours
(
CONCOURS_1
,
CONCOURS_2
(),
CONCOURS_3
());
assertThat
(
fileConcours
.
passerAuConcoursSuivant
()).
isFalse
();
forcer_la_fin_du_concours
(
concours
1
);
forcer_la_fin_du_concours
(
CONCOURS_
1
);
assertThat
(
fileConcours
.
passerAuConcoursSuivant
()).
isTrue
();
assertThat
(
fileConcours
.
concoursTermines
()).
isEqualTo
(
List
.
of
(
concours
1
));
assertThat
(
fileConcours
.
concoursTermines
()).
isEqualTo
(
List
.
of
(
CONCOURS_
1
));
}
void
forcer_la_fin_du_concours
(
Concours
concours
)
{
...
...
@@ -65,6 +76,15 @@ public class FileConcoursTest {
@Test
void
concours_auquel_un_chef_a_participe
()
{
Concours
CONCOURS_1
=
CONCOURS_1
();
Concours
CONCOURS_2
=
CONCOURS_2
();
FileConcours
fileConcours
=
new
FileConcours
(
CONCOURS_1
,
CONCOURS_2
,
CONCOURS_3
());
forcer_la_fin_du_concours
(
CONCOURS_1
);
fileConcours
.
passerAuConcoursSuivant
();
forcer_la_fin_du_concours
(
CONCOURS_2
);
fileConcours
.
passerAuConcoursSuivant
();
assertThat
(
fileConcours
.
concoursAuquelAParticipe
(
CHEF_1
)).
isEqualTo
(
List
.
of
(
CONCOURS_1
,
CONCOURS_2
));
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment