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
63efb5ef
Commit
63efb5ef
authored
Sep 11, 2024
by
Antoine Hazebrouck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
les concours de tel chefs
parent
c5fd52a4
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
62 additions
and
31 deletions
+62
-31
FileConcours.java
src/main/java/imt/FileConcours.java
+21
-0
ConcoursTest.java
src/test/java/imt/ConcoursTest.java
+26
-0
FileConcoursTest.java
src/test/java/imt/FileConcoursTest.java
+15
-31
No files found.
src/main/java/imt/FileConcours.java
0 → 100644
View file @
63efb5ef
package
imt
;
import
java.util.LinkedList
;
import
java.util.List
;
import
java.util.Queue
;
import
java.util.stream.Stream
;
public
class
FileConcours
{
private
final
Queue
<
Concours
>
concours
;
public
FileConcours
(
Concours
...
concours
)
{
this
.
concours
=
new
LinkedList
<
Concours
>(
Stream
.
of
(
concours
).
toList
());
}
public
List
<
Concours
>
concoursAuquelParticipe
(
Chef
chef
)
{
return
concours
.
stream
()
.
filter
(
concoursLoop
->
concoursLoop
.
getPropositions
().
stream
().
map
(
prop
->
prop
.
getChef
()).
toList
()
.
contains
(
chef
))
.
toList
();
}
}
src/test/java/imt/ConcoursTest.java
View file @
63efb5ef
package
imt
;
package
imt
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertEquals
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertEquals
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertThrows
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertThrows
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Optional
;
import
java.util.Set
;
import
java.util.Set
;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.Test
;
...
@@ -74,4 +78,26 @@ public class ConcoursTest {
...
@@ -74,4 +78,26 @@ public class ConcoursTest {
assertEquals
(
true
,
concours
.
estTermine
());
assertEquals
(
true
,
concours
.
estTermine
());
}
}
@Test
void
classement_actuel
()
{
Concours
concours1
=
new
Concours
(
jury1
,
jury2
,
jury3
,
propositions
);
List
<
Proposition
>
expected
=
new
ArrayList
<>();
expected
.
add
(
proposition1
);
expected
.
add
(
proposition2
);
expected
.
add
(
proposition3
);
expected
.
add
(
proposition4
);
expected
.
add
(
proposition5
);
proposition1
.
setNote
(
Optional
.
of
(
1
));
proposition2
.
setNote
(
Optional
.
of
(
2
));
proposition3
.
setNote
(
Optional
.
of
(
3
));
proposition4
.
setNote
(
Optional
.
of
(
4
));
// proposition5.setNote(Optional.of(100));
assertThat
(
concours1
.
classement
()).
isEqualTo
(
expected
);
System
.
out
.
println
(
concours1
.
classement
());
}
}
}
src/test/java/imt/FileConcoursTest.java
View file @
63efb5ef
package
imt
;
package
imt
;
import
static
imt
.
ConcoursTest
.
jury1
;
import
static
imt
.
ConcoursTest
.*;
import
static
imt
.
ConcoursTest
.
jury2
;
import
static
imt
.
ConcoursTest
.
jury3
;
import
static
imt
.
ConcoursTest
.
proposition1
;
import
static
imt
.
ConcoursTest
.
proposition2
;
import
static
imt
.
ConcoursTest
.
proposition3
;
import
static
imt
.
ConcoursTest
.
proposition4
;
import
static
imt
.
ConcoursTest
.
proposition5
;
import
static
imt
.
ConcoursTest
.
propositions
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
import
java.util.
ArrayLis
t
;
import
java.util.
HashSe
t
;
import
java.util.List
;
import
java.util.List
;
import
java.util.
Optional
;
import
java.util.
Set
;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.Test
;
import
imt.ingredients.Ingredient
;
public
class
FileConcoursTest
{
public
class
FileConcoursTest
{
@Test
@Test
void
fileDeConcours_passage_au_suivant
()
{
void
fileDeConcours_tout_les_concours_du_chef
()
{
Concours
concours1
=
new
Concours
(
jury1
,
jury2
,
jury3
,
propositions
);
Set
<
Proposition
>
propositionsSansTelChef
=
new
HashSet
<>(
propositions
);
}
propositionsSansTelChef
.
remove
(
proposition1
);
propositionsSansTelChef
.
add
(
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
[]
{})))));
@Test
void
fileDeConcours_classement_actuel
()
{
Concours
concours1
=
new
Concours
(
jury1
,
jury2
,
jury3
,
propositions
);
Concours
concours1
=
new
Concours
(
jury1
,
jury2
,
jury3
,
propositions
);
Concours
concours2
=
new
Concours
(
jury1
,
jury2
,
jury3
,
propositionsSansTelChef
);
Concours
concours3
=
new
Concours
(
jury1
,
jury2
,
jury3
,
new
HashSet
<>(
propositions
));
List
<
Proposition
>
expected
=
new
ArrayList
<>();
FileConcours
fileConcours
=
new
FileConcours
(
concours1
,
concours2
,
concours3
);
expected
.
add
(
proposition1
);
expected
.
add
(
proposition2
);
expected
.
add
(
proposition3
);
expected
.
add
(
proposition4
);
expected
.
add
(
proposition5
);
proposition1
.
setNote
(
Optional
.
of
(
1
));
proposition2
.
setNote
(
Optional
.
of
(
2
));
proposition3
.
setNote
(
Optional
.
of
(
3
));
proposition4
.
setNote
(
Optional
.
of
(
4
));
// proposition5.setNote(Optional.of(100));
assertThat
(
concours1
.
classement
()).
isEqualTo
(
expected
);
System
.
out
.
println
(
concours1
.
classement
(
));
assertThat
(
fileConcours
.
concoursAuquelParticipe
(
chef1
)).
isEqualTo
(
List
.
of
(
concours1
,
concours3
));
}
}
}
}
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