Skip to content
Snippets Groups Projects
Commit f4db1003 authored by Matteus Rødøy Mitei's avatar Matteus Rødøy Mitei
Browse files

Shorten and improve Hand-test

parent 52530d7c
No related branches found
No related tags found
No related merge requests found
Pipeline #265494 passed with stages
in 1 minute and 16 seconds
......@@ -3,9 +3,6 @@ package edu.ntnu.stud;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import java.util.HashSet;
import java.util.Set;
import static org.junit.jupiter.api.Assertions.*;
class HandTest {
......@@ -20,7 +17,7 @@ class HandTest {
void addCard() {
PlayingCard card = new PlayingCard('H', 5);
hand.addCard(card);
assertTrue(hand.size() == 1);
assertEquals(1, hand.size());
assertTrue(hand.toString().contains(card.getAsString()));
}
......@@ -29,18 +26,18 @@ class HandTest {
PlayingCard card = new PlayingCard('H', 5);
hand.addCard(card);
hand.clear();
assertTrue(hand.size() == 0);
assertEquals(0, hand.size());
assertTrue(hand.toString().isEmpty());
}
@Test
void size() {
assertTrue(hand.size() == 0);
assertEquals(0, hand.size());
PlayingCard card1 = new PlayingCard('H', 5);
PlayingCard card2 = new PlayingCard('D', 8);
hand.addCard(card1);
hand.addCard(card2);
assertTrue(hand.size() == 2);
assertEquals(2, hand.size());
}
@Test
......@@ -70,7 +67,7 @@ class HandTest {
hand.addCard(new PlayingCard('C', 4));
hand.addCard(new PlayingCard('S', 5));
hand.addCard(new PlayingCard('H', 6));
assertTrue(hand.sumOfFaces() == (2 + 3 + 4 + 5 + 6));
assertEquals((2 + 3 + 4 + 5 + 6), hand.sumOfFaces());
}
@Test
......@@ -80,7 +77,7 @@ class HandTest {
hand.addCard(new PlayingCard('C', 4));
hand.addCard(new PlayingCard('S', 5));
hand.addCard(new PlayingCard('H', 6));
assertTrue(hand.heartsAsString().equals("H2 H6"));
assertEquals("H2 H6", hand.heartsAsString());
}
@Test
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment