Fixed lots and lots of IDE warnings, so basically that

This commit is contained in:
Jordan Geurtsen
2022-09-21 00:02:46 +02:00
parent b047f50f1b
commit 02629bbee0
12 changed files with 18 additions and 26 deletions

View File

@@ -11,7 +11,7 @@
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>RELEASE</version>
<version>5.9.0</version>
<scope>test</scope>
</dependency>
<dependency>

View File

@@ -7,7 +7,7 @@ import java.util.Collections;
import java.util.List;
public class Dealer {
private Deck deck;
private final Deck deck;
public Dealer(Deck deck) {
this.deck = deck;

View File

@@ -1,5 +1,5 @@
package mau.mau;
public enum TYPENUM {
SPADES, HEARTS, DIAMONDS, CLUBS, JOKER;
SPADES, HEARTS, DIAMONDS, CLUBS, JOKER
}

View File

@@ -5,7 +5,7 @@ import mau.mau.players.Player;
import java.util.List;
public class TurnTable {
private List<Player> players;
private final List<Player> players;
private int currentPlayerIndex;
private int direction;

View File

@@ -4,13 +4,12 @@ import mau.mau.*;
import java.util.HashMap;
import java.util.List;
import java.util.Scanner;
public class Bot extends Player {
private static int nameIndex = 0;
private static String JSON = "src/main/resources/languages/en.json";
private static String JSON_KEY = "botnames";
private static final String JSON = "src/main/resources/languages/en.json";
private static final String JSON_KEY = "bot-names";
public Bot(Dealer dealer) {
super(dealer);
@@ -82,7 +81,7 @@ public class Bot extends Player {
try {
return JSONderulo.getJSONArrayFromJSONFile(JSON, JSON_KEY).getString(nameIndex++);
} catch (Exception e) {
System.out.println("Error reading botnames from JSON file");
System.out.println("Error reading bot-names from JSON file");
return "Koet " + nameIndex++;
}
}

View File

@@ -8,9 +8,9 @@ import java.util.List;
public abstract class Player {
private String name;
private final String name;
private List<Card> hand;
private Dealer dealer;
private final Dealer dealer;
public Player(Dealer dealer) {
this.dealer = dealer;
@@ -21,8 +21,8 @@ public abstract class Player {
return hand;
}
public List<Card> setHand(List<Card> hand) {
return this.hand = hand;
public void setHand(List<Card> hand) {
this.hand = hand;
}
public Boolean handIsEmpty() {

View File

@@ -20,7 +20,7 @@ loop until someone wins
else draw
User -> Player: draw()
end
else bot's turn
else bots turn
alt play
Bot -> Player: play(card)
Game <-- Player: playedCard

View File

@@ -1,5 +1,5 @@
{
"botnames": [
"bot-names": [
"Jordan",
"MaarKoet",
"El Tigre"

View File

@@ -15,13 +15,12 @@ public class CardHandlerTest {
private CardHandler sut;
private TurnTable turnTable;
private List<Player> players;
private Dealer dealer;
private Bot bot1, bot2, bot3;
@BeforeEach
public void setUp() {
//Arrange
dealer = new Dealer(new Deck());
Dealer dealer = new Dealer(new Deck());
sut = new CardHandler();
players = new ArrayList<>();
turnTable = new TurnTable(players);

View File

@@ -1,8 +1,4 @@
package mau.mau;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertTrue;
public class DealerTest {
}

View File

@@ -99,7 +99,7 @@ public class RefereeTest {
@Test
public void isAceOfSpadesValidEndcardTest(){
public void isAceOfSpadesValidEndCardTest(){
//Arrange
Card testCardOne = new Card(TYPENUM.SPADES, VALUENUM.ACE);
Card testCurrentCard = new Card(TYPENUM.HEARTS, VALUENUM.ACE);
@@ -112,7 +112,7 @@ public class RefereeTest {
}
@Test
public void isThreeOfHeartsValidEndcardTest(){
public void isThreeOfHeartsValidEndCardTest(){
//Arrange
Card testCardOne = new Card(TYPENUM.HEARTS, VALUENUM.THREE);
Card testCurrentCard = new Card(TYPENUM.HEARTS, VALUENUM.ACE);

View File

@@ -12,14 +12,12 @@ import static org.junit.jupiter.api.Assertions.*;
public class BotTest {
private Bot sut;
private Dealer dealer;
private Deck deck;
private List<Card> hand;
@BeforeEach
public void setUp() {
deck = new Deck();
dealer = new Dealer(deck);
Deck deck = new Deck();
Dealer dealer = new Dealer(deck);
sut = new Bot(dealer);
hand = new ArrayList<>();
}