|
@@ -1,22 +1,40 @@
|
1
|
1
|
package io.zipcoder.casino;
|
2
|
2
|
|
|
3
|
+import org.junit.Assert;
|
3
|
4
|
import org.junit.Test;
|
4
|
5
|
|
5
|
|
-import javax.smartcardio.Card;
|
6
|
|
-
|
7
|
6
|
public class CardTest {
|
8
|
7
|
|
9
|
|
-// @Test
|
10
|
|
-// public void createCard(){
|
11
|
|
-// Card card = new Card(Card.CardValue.TWO, Card.Suit.CLUBS);
|
12
|
|
-// System.out.println(card.getName());
|
13
|
|
-// }
|
14
|
|
-//
|
15
|
|
-// @Test
|
16
|
|
-// public void createCard2(){
|
17
|
|
-// Card card = new Card(Card.CardValue.TWO, Card.Suit.CLUBS);
|
18
|
|
-// Card card1 = new Card(Card.CardValue.QUEEN, Card.Suit.HEARTS);
|
19
|
|
-// System.out.println(card.getName());
|
20
|
|
-// System.out.println(card1.getName());
|
21
|
|
-// }
|
|
8
|
+ @Test
|
|
9
|
+ public void testCreateCard(){
|
|
10
|
+ Card card = new Card(Card.CardValue.TWO, Card.Suit.CLUBS);
|
|
11
|
+ String expected = "TWO of CLUBS";
|
|
12
|
+ String actual = card.getName();
|
|
13
|
+ Assert.assertEquals(expected, actual);
|
|
14
|
+ }
|
|
15
|
+
|
|
16
|
+ @Test
|
|
17
|
+ public void testGetSuit(){
|
|
18
|
+ Card card = new Card(Card.CardValue.THREE, Card.Suit.DIAMONDS);
|
|
19
|
+ Card.Suit expected = Card.Suit.DIAMONDS;
|
|
20
|
+ Card.Suit actual = card.getSuit();
|
|
21
|
+ Assert.assertEquals(expected, actual);
|
|
22
|
+ }
|
|
23
|
+
|
|
24
|
+ @Test
|
|
25
|
+ public void testGetCardValue(){
|
|
26
|
+ Card card = new Card(Card.CardValue.ACE, Card.Suit.HEARTS);
|
|
27
|
+ int expected = 14;
|
|
28
|
+ int actual = card.getCardValue();
|
|
29
|
+ Assert.assertEquals(expected, actual);
|
|
30
|
+ }
|
|
31
|
+
|
|
32
|
+ @Test
|
|
33
|
+ public void testVisibility(){
|
|
34
|
+ Card card = new Card(Card.CardValue.KING, Card.Suit.SPADES);
|
|
35
|
+ boolean before = card.isVisible();
|
|
36
|
+ card.setVisibility(true);
|
|
37
|
+ boolean after = card.isVisible();
|
|
38
|
+ Assert.assertNotEquals(before, after);
|
|
39
|
+ }
|
22
|
40
|
}
|