mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2025-01-18 20:36:17 +01:00
adjusted tests
This commit is contained in:
parent
758e9b8397
commit
e0ab09295d
@ -90,7 +90,7 @@ public class ServerGameLogicTest {
|
||||
// Arrange: Spieler initialisieren und Position setzen
|
||||
Player player = new Player(1, "Testspieler", mock(PlayerHandler.class)); // Spieler-Objekt erstellen
|
||||
Figure figure = mock(Figure.class); // Mock für die Spielfigur
|
||||
player.setFigure(figure); // Mock-Figur dem Spieler zuweisen
|
||||
|
||||
int initialFieldID = player.getFieldID(); // Startfeld
|
||||
DiceResult diceResult = new DiceResult(3, 4); // Würfel: 3 und 4
|
||||
|
||||
@ -106,7 +106,7 @@ public class ServerGameLogicTest {
|
||||
|
||||
// Assert: Position überprüfen und sicherstellen, dass `figure.moveTo` aufgerufen wurde
|
||||
assertEquals(expectedFieldID, player.getFieldID()); // Überprüfen, ob der Spieler auf dem erwarteten Feld ist
|
||||
verify(figure).moveTo(expectedFieldID); // Sicherstellen, dass die Figur bewegt wurde
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -748,7 +748,6 @@ public class ServerGameLogicTest {
|
||||
|
||||
// Create a player with mocked handler
|
||||
Player player = new Player(1, "Spieler 1", handler);
|
||||
player.setFigure(figure); // Set the mocked figure
|
||||
// player.setPosition(5); // Set the initial position
|
||||
|
||||
// Stub handler.getLogic() to return mocked ServerGameLogic
|
||||
@ -1028,7 +1027,11 @@ public class ServerGameLogicTest {
|
||||
|
||||
player.jail();
|
||||
|
||||
player.payBail();
|
||||
try {
|
||||
player.payBail();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// Assert: Spieler ist nicht mehr im Gulag und Geld wurde abgezogen
|
||||
assertTrue(player.canFinishTurn()); // Spieler kann den Zug beenden
|
||||
@ -1231,10 +1234,6 @@ public class ServerGameLogicTest {
|
||||
handler.addPlayer(player2);
|
||||
handler.addPlayer(player3);
|
||||
|
||||
player1.setFigure(figure); // Zuweisung einer Spielfigur
|
||||
player2.setFigure(figure);
|
||||
player3.setFigure(figure);
|
||||
|
||||
DeckHelper deckHelper = new DeckHelper();
|
||||
|
||||
Card card = null;
|
||||
@ -1263,7 +1262,7 @@ public class ServerGameLogicTest {
|
||||
// Arrange
|
||||
PlayerHandler handler = new PlayerHandler(null);
|
||||
Player player = new Player(1, handler);
|
||||
player.setFigure(figure);
|
||||
|
||||
DeckHelper deckHelper = new DeckHelper();
|
||||
|
||||
Card card = null;
|
||||
@ -1290,7 +1289,7 @@ public class ServerGameLogicTest {
|
||||
// Arrange
|
||||
PlayerHandler handler = new PlayerHandler(null);
|
||||
Player player = new Player(1, handler);
|
||||
player.setFigure(figure); // Zuweisung einer Spielfigur
|
||||
|
||||
DeckHelper deckHelper = new DeckHelper();
|
||||
|
||||
Card card = null;
|
||||
@ -1316,7 +1315,7 @@ public class ServerGameLogicTest {
|
||||
// Arrange
|
||||
PlayerHandler handler = new PlayerHandler(null);
|
||||
Player player = new Player(1, handler);
|
||||
player.setFigure(figure); // Zuweisung einer Spielfigur
|
||||
|
||||
DeckHelper deckHelper = new DeckHelper();
|
||||
|
||||
Card card = null;
|
||||
@ -1346,7 +1345,7 @@ public class ServerGameLogicTest {
|
||||
ServerGameLogic logic = mock(ServerGameLogic.class); // Mock ServerGameLogic
|
||||
PlayerHandler handler = new PlayerHandler(logic); // Übergebe den Mock
|
||||
Player player = new Player(1, handler);
|
||||
player.setFigure(figure); // Zuweisung einer Spielfigur
|
||||
|
||||
DeckHelper deckHelper = new DeckHelper();
|
||||
|
||||
Card card = null;
|
||||
@ -1370,7 +1369,7 @@ public class ServerGameLogicTest {
|
||||
ServerGameLogic logic = mock(ServerGameLogic.class); // Mock ServerGameLogic
|
||||
PlayerHandler handler = new PlayerHandler(logic); // Übergebe den Mock
|
||||
Player player = new Player(1, handler);
|
||||
player.setFigure(figure); // Zuweisung einer Spielfigur
|
||||
|
||||
handler.addPlayer(player); // Spieler zur Liste hinzufügen
|
||||
DeckHelper deckHelper = new DeckHelper();
|
||||
|
||||
@ -1395,7 +1394,7 @@ public class ServerGameLogicTest {
|
||||
ServerGameLogic logic = mock(ServerGameLogic.class); // Mock ServerGameLogic
|
||||
PlayerHandler handler = new PlayerHandler(logic); // Übergebe den Mock
|
||||
Player player = new Player(1, handler);
|
||||
player.setFigure(figure); // Zuweisung einer Spielfigur
|
||||
|
||||
handler.addPlayer(player); // Spieler zur Liste hinzufügen
|
||||
DeckHelper deckHelper = new DeckHelper();
|
||||
|
||||
@ -1422,7 +1421,7 @@ public class ServerGameLogicTest {
|
||||
ServerGameLogic logic = mock(ServerGameLogic.class); // Mock ServerGameLogic
|
||||
PlayerHandler handler = new PlayerHandler(logic); // Übergebe den Mock
|
||||
Player player = new Player(1, handler);
|
||||
player.setFigure(figure); // Zuweisung einer Spielfigur
|
||||
|
||||
handler.addPlayer(player); // Spieler zur Liste hinzufügen
|
||||
DeckHelper deckHelper = new DeckHelper();
|
||||
|
||||
@ -1449,7 +1448,7 @@ public class ServerGameLogicTest {
|
||||
ServerGameLogic logic = mock(ServerGameLogic.class); // Mock ServerGameLogic
|
||||
PlayerHandler handler = new PlayerHandler(logic); // Übergebe den Mock
|
||||
Player player = new Player(1, handler);
|
||||
player.setFigure(figure); // Zuweisung einer Spielfigur
|
||||
|
||||
handler.addPlayer(player); // Spieler zur Liste hinzufügen
|
||||
DeckHelper deckHelper = new DeckHelper();
|
||||
|
||||
@ -1484,7 +1483,7 @@ public class ServerGameLogicTest {
|
||||
ServerGameLogic logic = mock(ServerGameLogic.class); // Mock ServerGameLogic
|
||||
PlayerHandler handler = new PlayerHandler(logic); // Übergebe den Mock
|
||||
Player player = new Player(1, handler);
|
||||
player.setFigure(figure); // Zuweisung einer Spielfigur
|
||||
|
||||
player.setAccountBalance(1500); // Startguthaben
|
||||
handler.addPlayer(player); // Spieler zur Liste hinzufügen
|
||||
DeckHelper deckHelper = new DeckHelper();
|
||||
@ -1511,7 +1510,7 @@ public class ServerGameLogicTest {
|
||||
ServerGameLogic logic = mock(ServerGameLogic.class); // Mock ServerGameLogic
|
||||
PlayerHandler handler = new PlayerHandler(logic); // Übergebe den Mock
|
||||
Player player = new Player(1, handler);
|
||||
player.setFigure(figure); // Zuweisung einer Spielfigur
|
||||
|
||||
handler.addPlayer(player); // Spieler zur Liste hinzufügen
|
||||
DeckHelper deckHelper = new DeckHelper();
|
||||
|
||||
@ -1542,7 +1541,7 @@ public class ServerGameLogicTest {
|
||||
ServerGameLogic logic = mock(ServerGameLogic.class); // Mock ServerGameLogic
|
||||
PlayerHandler handler = new PlayerHandler(logic); // Übergebe den Mock
|
||||
Player player = new Player(1, handler);
|
||||
player.setFigure(figure); // Zuweisung einer Spielfigur
|
||||
|
||||
handler.addPlayer(player); // Spieler zur Liste hinzufügen
|
||||
DeckHelper deckHelper = new DeckHelper();
|
||||
|
||||
@ -1565,7 +1564,7 @@ public class ServerGameLogicTest {
|
||||
ServerGameLogic logic = mock(ServerGameLogic.class); // Mock ServerGameLogic
|
||||
PlayerHandler handler = new PlayerHandler(logic); // Übergebe den Mock
|
||||
Player player = new Player(1, handler);
|
||||
player.setFigure(figure); // Zuweisung einer Spielfigur
|
||||
|
||||
try {
|
||||
player.setPosition(10); // Starte auf Position 10
|
||||
} catch (Exception e) {
|
||||
@ -1594,7 +1593,7 @@ public class ServerGameLogicTest {
|
||||
ServerGameLogic logic = mock(ServerGameLogic.class); // Mock ServerGameLogic
|
||||
PlayerHandler handler = new PlayerHandler(logic); // Übergebe den Mock
|
||||
Player player = new Player(1, handler);
|
||||
player.setFigure(figure); // Zuweisung einer Spielfigur
|
||||
|
||||
handler.addPlayer(player); // Spieler zur Liste hinzufügen
|
||||
DeckHelper deckHelper = new DeckHelper();
|
||||
|
||||
@ -1619,7 +1618,7 @@ public class ServerGameLogicTest {
|
||||
ServerGameLogic logic = mock(ServerGameLogic.class); // Mock der ServerGameLogic
|
||||
PlayerHandler handler = new PlayerHandler(logic); // Mock-Logik übergeben
|
||||
Player player = new Player(1, handler);
|
||||
player.setFigure(figure); // Spielfigur setzen
|
||||
|
||||
handler.addPlayer(player); // Spieler hinzufügen
|
||||
DeckHelper deckHelper = new DeckHelper();
|
||||
|
||||
@ -1644,7 +1643,7 @@ public class ServerGameLogicTest {
|
||||
ServerGameLogic logic = mock(ServerGameLogic.class); // Mock der ServerGameLogic
|
||||
PlayerHandler handler = new PlayerHandler(logic); // Mock-Logik übergeben
|
||||
Player player = new Player(1, handler);
|
||||
player.setFigure(figure); // Spielfigur setzen
|
||||
|
||||
handler.addPlayer(player); // Spieler hinzufügen
|
||||
DeckHelper deckHelper = new DeckHelper();
|
||||
|
||||
@ -1673,7 +1672,7 @@ public class ServerGameLogicTest {
|
||||
PlayerHandler handler = new PlayerHandler(logic); // Mock-Logik übergeben
|
||||
|
||||
Player player = new Player(1, handler);
|
||||
player.setFigure(figure); // Spielfigur setzen
|
||||
|
||||
handler.addPlayer(player); // Spieler 1 hinzufügen
|
||||
|
||||
|
||||
@ -1698,7 +1697,7 @@ public class ServerGameLogicTest {
|
||||
ServerGameLogic logic = mock(ServerGameLogic.class); // Mock der ServerGameLogic
|
||||
PlayerHandler handler = new PlayerHandler(logic); // Mock-Logik übergeben
|
||||
Player player = new Player(1, handler);
|
||||
player.setFigure(figure); // Spielfigur setzen
|
||||
|
||||
player.setAccountBalance(1500); // Startsaldo setzen
|
||||
handler.addPlayer(player); // Spieler hinzufügen
|
||||
DeckHelper deckHelper = new DeckHelper();
|
||||
@ -1725,7 +1724,7 @@ public class ServerGameLogicTest {
|
||||
ServerGameLogic logic = mock(ServerGameLogic.class); // Mock der ServerGameLogic
|
||||
PlayerHandler handler = new PlayerHandler(logic); // Mock-Logik übergeben
|
||||
Player player = new Player(1, handler);
|
||||
player.setFigure(figure); // Spielfigur setzen
|
||||
|
||||
player.setAccountBalance(1500); // Startsaldo setzen
|
||||
handler.addPlayer(player); // Spieler hinzufügen
|
||||
DeckHelper deckHelper = new DeckHelper();
|
||||
@ -1753,7 +1752,7 @@ public class ServerGameLogicTest {
|
||||
ServerGameLogic logic = mock(ServerGameLogic.class); // Mock der ServerGameLogic
|
||||
PlayerHandler handler = new PlayerHandler(logic); // Mock-Logik übergeben
|
||||
Player player = new Player(1, handler);
|
||||
player.setFigure(figure); // Spielfigur setzen
|
||||
|
||||
handler.addPlayer(player); // Spieler hinzufügen
|
||||
DeckHelper deckHelper = new DeckHelper();
|
||||
|
||||
@ -1780,7 +1779,7 @@ public class ServerGameLogicTest {
|
||||
ServerGameLogic logic = mock(ServerGameLogic.class); // Mock der ServerGameLogic
|
||||
PlayerHandler handler = new PlayerHandler(logic); // Mock-Logik übergeben
|
||||
Player player = new Player(1, handler);
|
||||
player.setFigure(figure); // Spielfigur setzen
|
||||
|
||||
handler.addPlayer(player); // Spieler hinzufügen
|
||||
player.setAccountBalance(15000); // Anfangsstand des Kontos
|
||||
DeckHelper deckHelper = new DeckHelper();
|
||||
@ -1806,7 +1805,7 @@ public class ServerGameLogicTest {
|
||||
ServerGameLogic logic = mock(ServerGameLogic.class); // Mock der ServerGameLogic
|
||||
PlayerHandler handler = new PlayerHandler(logic); // Mock-Logik übergeben
|
||||
Player player = new Player(1, handler);
|
||||
player.setFigure(figure); // Spielfigur setzen
|
||||
|
||||
handler.addPlayer(player); // Spieler hinzufügen
|
||||
player.setAccountBalance(15000); // Anfangsstand des Kontos
|
||||
DeckHelper deckHelper = new DeckHelper();
|
||||
@ -1833,7 +1832,7 @@ public class ServerGameLogicTest {
|
||||
ServerGameLogic logic = mock(ServerGameLogic.class); // Mock der ServerGameLogic
|
||||
PlayerHandler handler = new PlayerHandler(logic); // Mock-Logik übergeben
|
||||
Player player = new Player(1, handler);
|
||||
player.setFigure(figure); // Spielfigur setzen
|
||||
|
||||
handler.addPlayer(player); // Spieler hinzufügen
|
||||
player.setAccountBalance(15000); // Anfangsstand des Kontos
|
||||
DeckHelper deckHelper = new DeckHelper();
|
||||
@ -1860,7 +1859,7 @@ public class ServerGameLogicTest {
|
||||
ServerGameLogic logic = mock(ServerGameLogic.class); // Mock der ServerGameLogic
|
||||
PlayerHandler handler = new PlayerHandler(logic); // Mock-Logik übergeben
|
||||
Player player = new Player(1, handler);
|
||||
player.setFigure(figure); // Spielfigur setzen
|
||||
|
||||
handler.addPlayer(player); // Spieler hinzufügen
|
||||
player.setAccountBalance(15000); // Startguthaben des Spielers
|
||||
DeckHelper deckHelper = new DeckHelper();
|
||||
|
Loading…
Reference in New Issue
Block a user