Commit b66d1f15 authored by Mamadou Saliou DIALLO's avatar Mamadou Saliou DIALLO

test: test initHand method for Tracked

parent 05bffb97
......@@ -231,4 +231,46 @@ class TrackedTest {
assertEquals(1, tracked.getDiscardSize());
}
/**
* Test init hand method.
* (1) When card list is null.
* (2) When card list size is different to {@link Player#INIT_HAND_SIZE}.
* (3) When card list has correct size, but player hand is full.
* (4) When card list has correct size and player hand is not full.
*/
@Test
void testInitHand() {
Tracked tracked1 = new Tracked("player1", "produ224");
/**
* (1) When card list is null.
*/
assertThrows(IllegalArgumentException.class, () -> {
tracked1.initHand(null);
});
/**
* (2) When card list size is different to {@link Player#INIT_HAND_SIZE}.
*/
int expectedSize = cards1.size() - 1;
cards1.remove(0);
assertEquals(expectedSize, cards1.size());
assertThrows(IllegalArgumentException.class, () -> {
tracked1.initHand(cards1);
});
/**
* todo: (3) When card list has correct size, but player hand is full.
*/
/**
* (4) When card list has correct size and player hand is not full.
*/
tracked1.initHand(cards2);
assertEquals(cards2.size(), tracked1.getHandSize());
assertTrue(tracked1.getHand().containsAll(cards2));
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment