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
Corentin GUILLEVIC
Not Alone
Commits
2b66891d
Commit
2b66891d
authored
Dec 16, 2020
by
Thomas DENIS
Browse files
Ajout test pour ReserveTest
parent
36e2a509
Changes
1
Hide whitespace changes
Inline
Side-by-side
not-alone-server/src/test/java/fr/univnantes/alma/server/game/item/ReserveTest.java
View file @
2b66891d
package
fr.univnantes.alma.server.game.item
;
import
fr.univnantes.alma.server.game.item.card.CardName
;
import
fr.univnantes.alma.server.game.item.card.PlaceCard
;
import
fr.univnantes.alma.server.game.item.card.SurvivalCard
;
import
fr.univnantes.alma.server.game.utilitary.Pair
;
import
javassist.NotFoundException
;
import
org.junit.jupiter.api.BeforeEach
;
import
org.junit.jupiter.api.Test
;
import
java.awt.*
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertTrue
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertFalse
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertEquals
;
class
ReserveTest
{
//TODO tests
List
<
PlaceCard
>
testCards
=
new
ArrayList
<>();
Reserve
reserve
;
@BeforeEach
void
test
(){
PlaceCard
c1
=
new
PlaceCard
(
CardName
.
ANTRE
,
"antre"
,
"antre"
,
6
,
"url1"
,
"bleu"
);
PlaceCard
c2
=
new
PlaceCard
(
CardName
.
PLAGE
,
"plage"
,
"plage"
,
7
,
"url2"
,
"bleu"
);
PlaceCard
c3
=
new
PlaceCard
(
CardName
.
JUNGLE
,
"jungle"
,
"jungle"
,
8
,
"url3"
,
"bleu"
);
PlaceCard
c4
=
new
PlaceCard
(
CardName
.
ABRI
,
"abri"
,
"abri"
,
9
,
"url4"
,
"bleu"
);
PlaceCard
c5
=
new
PlaceCard
(
CardName
.
RIVIERE
,
"riviere"
,
"riviere"
,
10
,
"url5"
,
"bleu"
);
testCards
.
add
(
c1
);
testCards
.
add
(
c2
);
testCards
.
add
(
c3
);
testCards
.
add
(
c4
);
testCards
.
add
(
c5
);
reserve
=
new
Reserve
(
testCards
,
4
);
}
@Test
void
testGetPlaceCards
(){
Map
<
Integer
,
Pair
<
PlaceCard
,
Integer
>>
placeCards
=
new
HashMap
<>();
for
(
PlaceCard
c
:
testCards
)
{
placeCards
.
put
(
c
.
getNumber
(),
new
Pair
<>(
c
,
2
));
}
assertEquals
(
placeCards
,
reserve
.
getPlaceCards
());
}
@Test
void
testIsNotEmpty
(){
assertTrue
(
reserve
.
isNotEmpty
());
}
@Test
void
testNotEmpty
(){
assertTrue
(
reserve
.
notEmpty
(
6
));
}
@Test
void
testPick
()
throws
NotFoundException
{
PlaceCard
c
=
new
PlaceCard
(
CardName
.
ANTRE
,
"antre"
,
"antre"
,
6
,
"url1"
,
"bleu"
);
assertEquals
(
c
,
reserve
.
pick
(
6
));
}
@Test
void
testAdd
()
throws
NotFoundException
{
PlaceCard
c
=
new
PlaceCard
(
CardName
.
MARAIS
,
"marais"
,
"marais"
,
6
,
"url"
,
"bleu"
);
reserve
.
add
(
c
);
assertEquals
(
c
,
reserve
.
pick
(
6
));
}
@Test
void
testEquals
(){
Reserve
rev
=
new
Reserve
(
testCards
,
4
);
assertEquals
(
reserve
,
rev
);
}
@Test
void
testToString
(){
assertEquals
(
"Reserve(ANTRE(2), PLAGE(2), JUNGLE(2), ABRI(2), RIVIERE(2))"
,
reserve
.
toString
());
}
}
\ No newline at end of file
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