Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
LI Qi
Bowling
Commits
3b1e3123
Commit
3b1e3123
authored
Feb 05, 2016
by
LI Qi
Browse files
add class Partie
parent
d7132b7b
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/jeu/Partie.java
0 → 100644
View file @
3b1e3123
package
jeu
;
import
java.util.ArrayList
;
import
java.util.List
;
public
class
Partie
{
List
<
Joueur
>
joueurs
;
public
Partie
()
{
this
.
joueurs
=
new
ArrayList
<
Joueur
>();
}
public
void
addJoueur
(
Joueur
j
)
{
joueurs
.
add
(
j
);
}
public
int
getJoueurNombre
()
{
return
joueurs
.
size
();
}
public
List
getJoueurs
()
{
return
joueurs
;
}
}
src/test/testPartie.java
0 → 100644
View file @
3b1e3123
package
test
;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.junit.Test
;
import
org.junit.Assert
;
import
jeu.Partie
;
import
jeu.Joueur
;
public
class
testPartie
{
private
Partie
partie
;
private
int
nomJoueur
;
private
Joueur
[]
joueurs
;
public
testPartie
()
{
this
.
partie
=
new
Partie
();
this
.
nomJoueur
=
3
;
this
.
joueurs
=
new
Joueur
[]
{
new
Joueur
(
"Alice"
),
new
Joueur
(
"Bob"
),
new
Joueur
(
"Charlie"
)};
for
(
int
i
=
0
;
i
<
joueurs
.
length
;
++
i
)
partie
.
addJoueur
(
joueurs
[
i
]);
}
@Test
public
void
testPartieConstructor
()
{
Assert
.
assertNotNull
(
partie
);
}
@Test
public
void
testPartieAddJoueur
()
{
//Assert.assertTrue(partie.getJoueurNombre() == nomJoueur);
Assert
.
assertEquals
(
partie
.
getJoueurNombre
(),
nomJoueur
);
List
<
Joueur
>
partieJoueurs
=
partie
.
getJoueurs
();
for
(
int
i
=
0
;
i
<
partieJoueurs
.
size
();
++
i
)
{
Assert
.
assertNotNull
(
partieJoueurs
.
get
(
i
));
Assert
.
assertEquals
(
joueurs
[
i
],
partieJoueurs
.
get
(
i
));
}
}
}
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