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
27a11d45
Commit
27a11d45
authored
Dec 11, 2020
by
Thomas DENIS
Browse files
Version 1 de HandTraqueTest
parent
9c2a0468
Changes
1
Hide whitespace changes
Inline
Side-by-side
not-alone-server/src/test/java/fr/univnantes/alma/server/game/item/player/hand/HandTraqueTest.java
View file @
27a11d45
package
fr.univnantes.alma.server.game.item.player.hand
;
import
fr.univnantes.alma.server.game.item.Phase
;
import
fr.univnantes.alma.server.game.item.card.*
;
import
fr.univnantes.alma.server.game.item.card.SurvivalCard
;
import
fr.univnantes.alma.server.game.item.card.SurvivalCard
;
import
org.junit.jupiter.api.Test
;
import
java.util.ArrayList
;
import
java.util.List
;
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
HandTraqueTest
{
//TODO tests
HandTraque
hand
=
new
HandTraque
();
@Test
public
void
testAddSurvivalCardToApplied
(){
SurvivalCard
card
=
new
SurvivalCard
(
CardName
.
ADRENALINE
,
"ADRENALINECard"
,
"yes adrenaline"
,
Phase
.
PHASE_2
);
hand
.
addSurvivalCardToApplied
(
card
);
assertTrue
(
hand
.
getSurvivalCardsToApplied
().
contains
(
card
));
}
@Test
public
void
testAddSurvivalCardToAppliedList
(){
SurvivalCard
card
=
new
SurvivalCard
(
CardName
.
ADRENALINE
,
"ADRENALINECard"
,
"yes adrenaline"
,
Phase
.
PHASE_2
);
List
<
SurvivalCard
>
testCards
=
new
ArrayList
<>();
testCards
.
add
(
card
);
hand
.
addSurvivalCardToApplied
(
testCards
);
assertTrue
(
hand
.
getSurvivalCardsToApplied
().
containsAll
(
testCards
));
}
@Test
public
void
testRemoveSurvivalCardToApplied
(){
SurvivalCard
card
=
new
SurvivalCard
(
CardName
.
ADRENALINE
,
"ADRENALINECard"
,
"yes adrenaline"
,
Phase
.
PHASE_2
);
hand
.
addSurvivalCardToApplied
(
card
);
hand
.
removeSurvivalCardToApplied
(
card
);
assertFalse
(
hand
.
getSurvivalCardsToApplied
().
contains
(
card
));
}
@Test
public
void
testRemoveSurvivalCardToAppliedList
(){
SurvivalCard
card
=
new
SurvivalCard
(
CardName
.
ADRENALINE
,
"ADRENALINECard"
,
"yes adrenaline"
,
Phase
.
PHASE_2
);
List
<
SurvivalCard
>
testCards
=
new
ArrayList
<>();
testCards
.
add
(
card
);
hand
.
addSurvivalCardToApplied
(
testCards
);
hand
.
removeSurvivalCardToApplied
(
testCards
);
assertFalse
(
hand
.
getSurvivalCardsToApplied
().
containsAll
(
testCards
));
}
@Test
public
void
testGetSurvivalCardToApplied
(){
assertEquals
(
hand
.
getSurvivalCardsToApplied
(),
new
ArrayList
<>());
}
/* PlaceCardDeck methods */
@Test
public
void
testSetPlaceCards
()
{
PlaceCard
card
=
new
PlaceCard
(
CardName
.
ANTRE
,
"antre"
,
"antre"
,
1
,
"url"
,
"bleu"
);
List
<
PlaceCard
>
testCards
=
new
ArrayList
<>();
testCards
.
add
(
card
);
hand
.
setPlaceCards
(
testCards
);
assertTrue
(
hand
.
getPlaceCards
().
containsAll
(
testCards
));
}
@Test
public
void
testSetDefausse
()
{
PlaceCard
card
=
new
PlaceCard
(
CardName
.
ANTRE
,
"antre"
,
"antre"
,
1
,
"url"
,
"bleu"
);
List
<
PlaceCard
>
testCards
=
new
ArrayList
<>();
testCards
.
add
(
card
);
hand
.
setDefausse
(
testCards
);
assertTrue
(
hand
.
getDefausse
().
containsAll
(
testCards
));
}
@Test
public
void
testPlaceCardHandSize
(){
assertEquals
(
hand
.
placeCardHandSize
(),
0
);
}
@Test
public
void
testPlaceCardIsEmpty
(){
assertTrue
(
hand
.
placeCardIsEmpty
());
}
@Test
public
void
testDefausseSize
(){
assertEquals
(
hand
.
defausseSize
(),
0
);
}
@Test
public
void
testDefausseIsEmpty
(){
assertTrue
(
hand
.
defausseIsEmpty
());
}
@Test
public
void
testPlaceCardPlayedSize
(){
assertEquals
(
hand
.
placeCardPlayedSize
(),
0
);
}
@Test
public
void
testPlaceCardPlayedIsEmpty
(){
assertTrue
(
hand
.
placeCardPlayedIsEmpty
());
}
/* SurvivalCards Methods */
@Test
public
void
testSurvivalCardHandSize
(){
assertEquals
(
0
,
hand
.
survivalCardHandSize
());
}
@Test
public
void
testSurvivalCardPlayedSize
(){
assertEquals
(
0
,
hand
.
survivalCardPlayedSize
());
}
@Test
public
void
testSurvivalCardHandIsEmpty
(){
assertTrue
(
hand
.
survivalCardIsEmpty
());
}
@Test
public
void
testSurvivalCardHandPlayedIsEmpty
(){
assertTrue
(
hand
.
survivalCardPlayedIsEmpty
());
}
@Test
public
void
testClearSurvivalCardPlayed
(){
SurvivalCard
card
=
new
SurvivalCard
(
CardName
.
INTERFERENCES
,
"InterferenceCard"
,
"The powers of the Beach and the Wreck are ineffective"
,
Phase
.
PHASE_2
);
hand
.
addSurvivalCard
(
card
);
hand
.
playSurvivalCard
(
card
);
hand
.
clearSurvivalCardPlayed
();
assertTrue
(
hand
.
survivalCardPlayedIsEmpty
());
}
@Test
public
void
testAddSurvivalCard
(){
SurvivalCard
card
=
new
SurvivalCard
(
CardName
.
INTERFERENCES
,
"InterferenceCard"
,
"The powers of the Beach and the Wreck are ineffective"
,
Phase
.
PHASE_2
);
hand
.
addSurvivalCard
(
card
);
assertTrue
(
hand
.
getSurvivalCardsHand
().
contains
(
card
));
}
@Test
public
void
testAddSurvivalCardList
(){
SurvivalCard
card
=
new
SurvivalCard
(
CardName
.
INTERFERENCES
,
"InterferenceCard"
,
"The powers of the Beach and the Wreck are ineffective"
,
Phase
.
PHASE_2
);
List
<
SurvivalCard
>
testCards
=
new
ArrayList
<>();
testCards
.
add
(
card
);
hand
.
addSurvivalCard
(
testCards
);
assertTrue
(
hand
.
getSurvivalCardsHand
().
containsAll
(
testCards
));
}
@Test
public
void
testRemoveSurvivalCard
(){
SurvivalCard
card
=
new
SurvivalCard
(
CardName
.
INTERFERENCES
,
"InterferenceCard"
,
"The powers of the Beach and the Wreck are ineffective"
,
Phase
.
PHASE_2
);
hand
.
addSurvivalCard
(
card
);
hand
.
removeSurvivalCard
(
card
);
assertFalse
(
hand
.
getSurvivalCardsHand
().
contains
(
card
));
}
@Test
public
void
testRemoveSurvivalCardList
(){
SurvivalCard
card
=
new
SurvivalCard
(
CardName
.
INTERFERENCES
,
"InterferenceCard"
,
"The powers of the Beach and the Wreck are ineffective"
,
Phase
.
PHASE_2
);
List
<
SurvivalCard
>
testCards
=
new
ArrayList
<>();
testCards
.
add
(
card
);
hand
.
addSurvivalCard
(
testCards
);
hand
.
removeSurvivalCard
(
testCards
);
assertFalse
(
hand
.
getSurvivalCardsHand
().
containsAll
(
testCards
));
}
@Test
public
void
testPlaySurvivalCard
(){
SurvivalCard
card
=
new
SurvivalCard
(
CardName
.
INTERFERENCES
,
"InterferenceCard"
,
"The powers of the Beach and the Wreck are ineffective"
,
Phase
.
PHASE_2
);
hand
.
addSurvivalCard
(
card
);
assertTrue
(
hand
.
playSurvivalCard
(
card
));
assertFalse
(
hand
.
getSurvivalCardsHand
().
contains
(
card
));
assertTrue
(
hand
.
getSurvivalCardsPlayed
().
contains
(
card
));
}
@Test
public
void
testPlaySurvivalCardList
(){
SurvivalCard
card
=
new
SurvivalCard
(
CardName
.
INTERFERENCES
,
"InterferenceCard"
,
"The powers of the Beach and the Wreck are ineffective"
,
Phase
.
PHASE_2
);
List
<
SurvivalCard
>
testCards
=
new
ArrayList
<>();
testCards
.
add
(
card
);
hand
.
addSurvivalCard
(
testCards
);
assertTrue
(
hand
.
playSurvivalCard
(
testCards
));
assertFalse
(
hand
.
getSurvivalCardsHand
().
containsAll
(
testCards
));
assertTrue
(
hand
.
getSurvivalCardsPlayed
().
containsAll
(
testCards
));
}
}
\ 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