test anfang

main
Luc Vonnemann 2024-03-26 10:43:07 +01:00
parent 4f23988517
commit 9ec9925586
3 changed files with 50 additions and 2 deletions

View File

@ -7,5 +7,37 @@
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module-library">
<library name="JUnit5.8.1">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter/5.8.1/junit-jupiter-5.8.1.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-api/5.8.1/junit-jupiter-api-5.8.1.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/opentest4j/opentest4j/1.2.0/opentest4j-1.2.0.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-commons/1.8.1/junit-platform-commons-1.8.1.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/apiguardian/apiguardian-api/1.1.2/apiguardian-api-1.1.2.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-params/5.8.1/junit-jupiter-params-5.8.1.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-engine/5.8.1/junit-jupiter-engine-5.8.1.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-engine/1.8.1/junit-platform-engine-1.8.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="JUnit5.8.1">
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/junit-jupiter-5.8.1.jar!/" />
<root url="jar://$MODULE_DIR$/../lib/junit-jupiter-api-5.8.1.jar!/" />
<root url="jar://$MODULE_DIR$/../lib/opentest4j-1.2.0.jar!/" />
<root url="jar://$MODULE_DIR$/../lib/junit-platform-commons-1.8.1.jar!/" />
<root url="jar://$MODULE_DIR$/../lib/apiguardian-api-1.1.2.jar!/" />
<root url="jar://$MODULE_DIR$/../lib/junit-jupiter-params-5.8.1.jar!/" />
<root url="jar://$MODULE_DIR$/../lib/junit-jupiter-engine-5.8.1.jar!/" />
<root url="jar://$MODULE_DIR$/../lib/junit-platform-engine-1.8.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
</component>
</module>

View File

@ -1,6 +1,6 @@
public class Hand {
private Card[] current_hand = new Card[11];
public Card[] current_hand = new Card[11];
private int current_points;
CardStack cs;
public int old_hand_counter;
@ -47,7 +47,6 @@ public class Hand {
public void draw_card() {
Card drawn_card = cs.draw_card();
System.out.println("die karte ist " + drawn_card.card_value);
current_hand[(cs.card_draw_counter - old_hand_counter) - 1] = drawn_card;

View File

@ -1,5 +1,22 @@
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
class HandTest {
CardStack cs = new CardStack();
Hand hand = new Hand(cs);
@Test
void get_points_test() {
assertEquals(hand.current_hand[0].get_points(hand.current_hand[0]) +
hand.current_hand[1].get_points(hand.current_hand[1]),
hand.get_points());
}
@Test
void draw_card_test() {
hand.draw_card();
assertNotNull(hand.current_hand[2]);
}
}