|
@ -1,15 +1,21 @@ |
|
|
package solitaer; |
|
|
package solitaer; |
|
|
|
|
|
|
|
|
import static org.junit.jupiter.api.Assertions.*; |
|
|
import static org.junit.jupiter.api.Assertions.*; |
|
|
|
|
|
import static org.mockito.Mockito.verify; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.stream.Stream; |
|
|
|
|
|
|
|
|
import org.junit.jupiter.api.Test; |
|
|
import org.junit.jupiter.api.Test; |
|
|
|
|
|
import org.junit.jupiter.params.ParameterizedTest; |
|
|
|
|
|
import org.junit.jupiter.params.provider.Arguments; |
|
|
|
|
|
import org.junit.jupiter.params.provider.MethodSource; |
|
|
|
|
|
|
|
|
class CardDeckTest { |
|
|
class CardDeckTest { |
|
|
|
|
|
|
|
|
|
|
|
private CardDeck deck = new CardDeck(); |
|
|
|
|
|
|
|
|
@Test |
|
|
@Test |
|
|
void testCardDeckSize() { |
|
|
void testCardDeckSize() { |
|
|
CardDeck deck = new CardDeck(); |
|
|
|
|
|
|
|
|
|
|
|
int result = deck.getDeck().size(); |
|
|
int result = deck.getDeck().size(); |
|
|
|
|
|
|
|
|
assertEquals(52, result, "Kartendeck muss genau 52 Carden haben") ; |
|
|
assertEquals(52, result, "Kartendeck muss genau 52 Carden haben") ; |
|
@ -17,5 +23,32 @@ class CardDeckTest { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ParameterizedTest |
|
|
|
|
|
@MethodSource("testSymbole") |
|
|
|
|
|
void testCardDeckSymbole(String msg, Symbol _sym) { |
|
|
|
|
|
|
|
|
|
|
|
boolean result = false; |
|
|
|
|
|
|
|
|
|
|
|
for(int i = 0; i<deck.getDeck().size(); i++) { |
|
|
|
|
|
if(deck.getDeck().get(i).getSymbol() == _sym) { |
|
|
|
|
|
result = true; |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
assertTrue(result, msg); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static Stream<Arguments> testSymbole(){ |
|
|
|
|
|
return Stream.of( |
|
|
|
|
|
Arguments.of("Herz", Symbol.Herz), |
|
|
|
|
|
Arguments.of("Karo", Symbol.Karo), |
|
|
|
|
|
Arguments.of("Pik", Symbol.Pik), |
|
|
|
|
|
Arguments.of("Kreuz",Symbol.Kreuz) |
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |