Skip to content
Snippets Groups Projects

Removed extra test class

Merged Charlotte Corapi requested to merge master into main
1 file
+ 0
62
Compare changes
  • Side-by-side
  • Inline
package edu.ntnu.idatt2003;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import edu.ntnu.idatt2003.model.DeckOfCards;
import edu.ntnu.idatt2003.KortspillApplication;
import javafx.scene.control.Button;
import javafx.stage.Stage;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import java.awt.*;
public class KortspillApplicationTest {
KortspillApplication app;
@BeforeEach
void setUp() {
app = new KortspillApplication();
}
@Nested
@DisplayName("Testing the dealHandButton method")
class TestDealHandButton {
@Test
@DisplayName("Testing the dealHandButton method with enough cards")
void testDealHandButton() {
String result = app.dealHandButton();
assertNotNull(result);
assertNotEquals("Not enough cards in the deck", result);
}
@Test
@DisplayName("Testing the dealHandButton method with not enough cards")
void testDealHandButtonNotEnoughCards() {
DeckOfCards deck = new DeckOfCards();
for (int i = 0; i < 52; i++) {
deck.removeCard(0);
}
app.cardDeck.getCardDeck().clear();
String result = app.dealHandButton();
assertEquals("Not enough cards in the deck", result);
}
}
@Nested
@DisplayName("Testing the getCheckHandButton method")
class TestCheckHandButton {
@Test
@DisplayName("Testing the getCheckHandButton method")
void testCheckHandButton() {
Button checkHandButton = app.getCheckHandButton();
assertNotNull(checkHandButton);
assertEquals("Check Hand", checkHandButton.getText());
}
}
}
\ No newline at end of file
Loading