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
7d1e0678
Commit
7d1e0678
authored
Sep 11, 2024
by
Antoine Hazebrouck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
un coucours marche
parent
554eb658
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
180 additions
and
17 deletions
+180
-17
Application.java
src/main/java/imt/Application.java
+3
-3
Chef.java
src/main/java/imt/Chef.java
+6
-1
Concours.java
src/main/java/imt/Concours.java
+45
-0
Jury.java
src/main/java/imt/Jury.java
+7
-13
Plat.java
src/main/java/imt/Plat.java
+16
-0
Proposition.java
src/main/java/imt/Proposition.java
+18
-0
ConcoursTest.java
src/test/java/imt/ConcoursTest.java
+75
-0
FileConcoursTest.java
src/test/java/imt/FileConcoursTest.java
+10
-0
No files found.
src/main/java/imt/Application.java
View file @
7d1e0678
...
...
@@ -3,9 +3,9 @@ package imt;
public
class
Application
{
public
static
void
main
(
String
[]
args
)
{
var
chef
=
new
Chef
(
1
,
"Caca"
,
"Pipi"
,
"DQSQFQSF"
,
Genre
.
HOMME
,
3
,
Specialite
.
CUISINIER
);
var
padawan
=
new
Padawan
(
1
,
"Hazebrouck"
,
"Antoine"
,
"06 51 73 08 05"
,
Genre
.
HOMME
,
chef
);
//
var chef = new Chef(1, "Caca", "Pipi", "DQSQFQSF", Genre.HOMME, 3, Specialite.CUISINIER);
//
var padawan = new Padawan(1, "Hazebrouck", "Antoine", "06 51 73 08 05", Genre.HOMME, chef);
System
.
out
.
println
(
padawan
);
//
System.out.println(padawan);
}
}
src/main/java/imt/Chef.java
View file @
7d1e0678
package
imt
;
import
java.util.Set
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.ToString
;
...
...
@@ -10,10 +12,13 @@ import lombok.ToString;
public
class
Chef
extends
Person
{
private
final
int
etoiles
;
private
final
Specialite
specialite
;
private
final
Set
<
Plat
>
plats
;
public
Chef
(
int
id
,
String
nom
,
String
prenom
,
String
telephone
,
Genre
genre
,
int
etoiles
,
Specialite
specialite
)
{
public
Chef
(
int
id
,
String
nom
,
String
prenom
,
String
telephone
,
Genre
genre
,
int
etoiles
,
Specialite
specialite
,
Set
<
Plat
>
plats
)
{
super
(
id
,
nom
,
prenom
,
telephone
,
genre
);
this
.
etoiles
=
etoiles
;
this
.
specialite
=
specialite
;
this
.
plats
=
plats
;
}
}
src/main/java/imt/Concours.java
0 → 100644
View file @
7d1e0678
package
imt
;
import
java.util.Optional
;
import
java.util.Set
;
import
lombok.Data
;
@Data
public
class
Concours
{
private
final
Jury
jury1
;
private
final
Jury
jury2
;
private
final
Jury
jury3
;
private
final
Set
<
Proposition
>
propositions
;
// minimun 5
public
Concours
(
Jury
jury1
,
Jury
jury2
,
Jury
jury3
,
Set
<
Proposition
>
propositions
)
{
this
.
jury1
=
jury1
;
this
.
jury2
=
jury2
;
this
.
jury3
=
jury3
;
for
(
Proposition
proposition
:
propositions
)
{
if
(
proposition
.
getChef
().
getPlats
().
contains
(
proposition
.
getPlatPropose
())
==
false
)
{
throw
new
IllegalArgumentException
();
}
}
if
(
propositions
.
size
()
!=
5
)
{
throw
new
IllegalArgumentException
();
}
else
{
this
.
propositions
=
propositions
;
}
}
public
boolean
estTermine
()
{
return
propositions
.
stream
()
.
allMatch
(
proposition
->
proposition
.
getNote
().
isPresent
());
}
public
void
noter
(
Proposition
proposition
,
int
note
)
{
for
(
Proposition
propositionLoop
:
propositions
)
{
if
(
propositionLoop
.
equals
(
proposition
))
{
propositionLoop
.
setNote
(
Optional
.
of
(
note
));
}
}
}
}
src/main/java/imt/Jury.java
View file @
7d1e0678
//
package imt;
package
imt
;
// import lombok.Data;
// import lombok.EqualsAndHashCode;
public
class
Jury
extends
Person
{
// @EqualsAndHashCode(callSuper = true)
// @Data
// public class Jury extends Person {
// // private final int TODO faire les jurys
// public Jury() {
// super(null, null, null, null, null);
// }
// }
// TODO finir quand les Jurys sont finito
\ No newline at end of file
public
Jury
(
int
id
,
String
nom
,
String
prenom
,
String
telephone
,
Genre
genre
)
{
super
(
id
,
nom
,
prenom
,
telephone
,
genre
);
//TODO Auto-generated constructor stub
}
}
\ No newline at end of file
src/main/java/imt/Plat.java
0 → 100644
View file @
7d1e0678
package
imt
;
import
lombok.Data
;
@Data
public
class
Plat
{
private
final
String
something
;
public
Plat
(
String
something
)
{
this
.
something
=
something
;
}
public
Plat
()
{
something
=
""
;
}
}
src/main/java/imt/Proposition.java
0 → 100644
View file @
7d1e0678
package
imt
;
import
java.util.Optional
;
import
lombok.Data
;
@Data
public
class
Proposition
{
private
final
Plat
platPropose
;
private
final
Chef
chef
;
private
Optional
<
Integer
>
note
;
public
Proposition
(
Plat
platPropose
,
Chef
chef
)
{
this
.
platPropose
=
platPropose
;
this
.
chef
=
chef
;
this
.
note
=
Optional
.
empty
();
}
}
src/test/java/imt/ConcoursTest.java
0 → 100644
View file @
7d1e0678
package
imt
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertEquals
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertThrows
;
import
java.util.Set
;
import
org.junit.jupiter.api.Test
;
public
class
ConcoursTest
{
Jury
jury1
=
new
Jury
(
1
,
"nom1"
,
"prenom1"
,
"06"
,
Genre
.
HOMME
);
Jury
jury2
=
new
Jury
(
2
,
"nom2"
,
"prenom2"
,
"06"
,
Genre
.
HOMME
);
Jury
jury3
=
new
Jury
(
3
,
"nom3"
,
"prenom3"
,
"06"
,
Genre
.
HOMME
);
Chef
chef1
=
new
Chef
(
1
,
"chef1"
,
"prenomchef1"
,
"07"
,
Genre
.
HOMME
,
2
,
Specialite
.
PATISSIER
,
Set
.
of
(
new
Plat
(
"plat1"
)));
Chef
chef2
=
new
Chef
(
2
,
"chef2"
,
"prenomchef2"
,
"07"
,
Genre
.
HOMME
,
2
,
Specialite
.
PATISSIER
,
Set
.
of
(
new
Plat
(
"plat2"
)));
Chef
chef3
=
new
Chef
(
3
,
"chef3"
,
"prenomchef3"
,
"07"
,
Genre
.
HOMME
,
2
,
Specialite
.
PATISSIER
,
Set
.
of
(
new
Plat
(
"plat3"
)));
Chef
chef4
=
new
Chef
(
4
,
"chef4"
,
"prenomchef4"
,
"07"
,
Genre
.
HOMME
,
2
,
Specialite
.
PATISSIER
,
Set
.
of
(
new
Plat
(
"plat4"
)));
Chef
chef5
=
new
Chef
(
5
,
"chef5"
,
"prenomchef5"
,
"07"
,
Genre
.
HOMME
,
2
,
Specialite
.
PATISSIER
,
Set
.
of
(
new
Plat
(
"plat5"
)));
@Test
void
concours_trois_jurys_cinq_chefs
()
{
var
propositions
=
Set
.
of
(
new
Proposition
(
new
Plat
(
"plat1"
),
chef1
),
new
Proposition
(
new
Plat
(
"plat2"
),
chef2
),
new
Proposition
(
new
Plat
(
"plat3"
),
chef3
),
new
Proposition
(
new
Plat
(
"plat4"
),
chef4
));
assertThrows
(
IllegalArgumentException
.
class
,
()
->
new
Concours
(
jury1
,
jury2
,
jury3
,
propositions
));
}
@Test
void
les_chefs_proposent_un_plat_qu_ils_savent_faire
()
{
var
propositions
=
Set
.
of
(
new
Proposition
(
new
Plat
(
"plat1"
),
chef1
),
new
Proposition
(
new
Plat
(
"plat2"
),
chef2
),
new
Proposition
(
new
Plat
(
"plat3"
),
chef3
),
new
Proposition
(
new
Plat
(
"plat4"
),
chef4
),
new
Proposition
(
new
Plat
(
"je sais pas faire donc exception"
),
chef5
));
assertThrows
(
IllegalArgumentException
.
class
,
()
->
new
Concours
(
jury1
,
jury2
,
jury3
,
propositions
));
}
@Test
void
fin_du_concours
()
{
Proposition
proposition1
=
new
Proposition
(
new
Plat
(
"plat1"
),
chef1
);
Proposition
proposition2
=
new
Proposition
(
new
Plat
(
"plat2"
),
chef2
);
Proposition
proposition3
=
new
Proposition
(
new
Plat
(
"plat3"
),
chef3
);
Proposition
proposition4
=
new
Proposition
(
new
Plat
(
"plat4"
),
chef4
);
Proposition
proposition5
=
new
Proposition
(
new
Plat
(
"plat5"
),
chef5
);
Concours
concours
=
new
Concours
(
jury1
,
jury2
,
jury3
,
Set
.
of
(
proposition1
,
proposition2
,
proposition3
,
proposition4
,
proposition5
));
assertEquals
(
false
,
concours
.
estTermine
());
concours
.
noter
(
proposition1
,
10
);
concours
.
noter
(
proposition2
,
3
);
concours
.
noter
(
proposition3
,
8
);
concours
.
noter
(
proposition4
,
9
);
concours
.
noter
(
proposition5
,
18
);
assertEquals
(
true
,
concours
.
estTermine
());
}
}
src/test/java/imt/FileConcoursTest.java
0 → 100644
View file @
7d1e0678
package
imt
;
import
org.junit.jupiter.api.Test
;
public
class
FileConcoursTest
{
@Test
void
fileDeConcours
()
{
}
}
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