@ -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;
@ -0,0 +1,23 @@
import java.util.ArrayList;
public class CardDeck {
private ArrayList<Card> deck = new ArrayList<Card>();
public CardDeck() {
for(int i= 0; i<52; i++) {
deck.add(new Card(i, Symbol.Herz, false));
public ArrayList<Card> getDeck() {
return deck;
@ -0,0 +1,21 @@
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") ;