diff --git a/src/main/java/solitaer/Card.java b/src/main/java/solitaer/Card.java new file mode 100644 index 0000000..38bb04d --- /dev/null +++ b/src/main/java/solitaer/Card.java @@ -0,0 +1,28 @@ +package solitaer; + +import javax.swing.JPanel; + +enum Symbol { + Herz, Karo, Kreuz, Pik +} + +public class Card extends JPanel { + + /** + * + */ + private static final long serialVersionUID = 1L; + private int nr; + private Symbol symbol; + + private boolean faceUp; + + public Card(int nr, Symbol symbol, boolean faceUp) { + this.nr = nr; + this.symbol = symbol; + this.faceUp = faceUp; + } + + + +} diff --git a/src/main/java/solitaer/CardDeck.java b/src/main/java/solitaer/CardDeck.java new file mode 100644 index 0000000..522a7fd --- /dev/null +++ b/src/main/java/solitaer/CardDeck.java @@ -0,0 +1,23 @@ +package solitaer; + +import java.util.ArrayList; + +public class CardDeck { + + private ArrayList deck = new ArrayList(); + + + public CardDeck() { + for(int i= 0; i<52; i++) { + deck.add(new Card(i, Symbol.Herz, false)); + } + + } + + + public ArrayList getDeck() { + return deck; + } + + +} diff --git a/src/test/java/solitaer/CardDeckTest.java b/src/test/java/solitaer/CardDeckTest.java new file mode 100644 index 0000000..751c85d --- /dev/null +++ b/src/test/java/solitaer/CardDeckTest.java @@ -0,0 +1,21 @@ +package solitaer; + +import static org.junit.jupiter.api.Assertions.*; + +import org.junit.jupiter.api.Test; + +class CardDeckTest { + + @Test + void testCardDeckSize() { + CardDeck deck = new CardDeck(); + + int result = deck.getDeck().size(); + + assertEquals(52, result, "Kartendeck muss genau 52 Carden haben") ; + + } + + + +}