mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2025-01-19 00:06:16 +01:00
first tests
This commit is contained in:
parent
3b2cfad774
commit
b702e3a14d
@ -165,7 +165,7 @@ public class MonopolyApp extends SimpleApplication implements MonopolyClient, Ga
|
||||
* Constructs a new {@code MonopolyApp} instance.
|
||||
* Initializes the configuration, server connection, and game logic listeners.
|
||||
*/
|
||||
private MonopolyApp() {
|
||||
public MonopolyApp() {
|
||||
config = new MonopolyAppConfig();
|
||||
config.readFromIfExists(CONFIG_FILE);
|
||||
serverConnection = makeServerConnection();
|
||||
|
@ -158,6 +158,14 @@ public class Player implements FieldVisitor<Void>{
|
||||
return accountBalance >= 0;
|
||||
}
|
||||
|
||||
public PlayerState getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
public void setState(PlayerState state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
/**
|
||||
* Moves the player by a given number of steps, handling board wrapping.
|
||||
*
|
||||
|
@ -19,7 +19,7 @@ public class Card {
|
||||
return description;
|
||||
} // TODO wird gerade in der EventCard zur erstellung des Popup genutzt
|
||||
|
||||
String getKeyword() {
|
||||
public String getKeyword() {
|
||||
return keyword;
|
||||
}
|
||||
}
|
||||
|
@ -1,387 +0,0 @@
|
||||
/*
|
||||
package pp.monopoly;
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
public class Testhandbuch {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// T001 UC-game-01 - testStartApplication
|
||||
@Test
|
||||
public void testStartApplication() {
|
||||
MonopolyApp app = new MonopolyApp();
|
||||
app.simpleInitApp();
|
||||
MainMenu mainMenu = app.getStateManager().getState(MainMenu.class);
|
||||
assertNotNull(mainMenu);
|
||||
}
|
||||
|
||||
// T002 UC-game-02 - testOpenStartMenu
|
||||
@Test
|
||||
public void testOpenStartMenu() {
|
||||
MonopolyApp app = new MonopolyApp();
|
||||
app.simpleInitApp();
|
||||
MainMenu mainMenu = app.getStateManager().getState(MainMenu.class);
|
||||
mainMenu.showMenu();
|
||||
assertTrue(mainMenu.isMenuVisible());
|
||||
}
|
||||
|
||||
// T003 UC-game-03 - testNavigateToPlayOption
|
||||
@Test
|
||||
public void testNavigateToPlayOption() {
|
||||
MonopolyApp app = new MonopolyApp();
|
||||
app.simpleInitApp();
|
||||
MainMenu mainMenu = app.getStateManager().getState(MainMenu.class);
|
||||
mainMenu.showMenu();
|
||||
mainMenu.startNewGame();
|
||||
NewGameMenu newGameMenu = app.getStateManager().getState(NewGameMenu.class);
|
||||
assertNotNull(newGameMenu);
|
||||
}
|
||||
|
||||
// T004 UC-game-04 - testExitApplicationFromMenu
|
||||
@Test
|
||||
public void testExitApplicationFromMenu() {
|
||||
MonopolyApp app = new MonopolyApp();
|
||||
app.simpleInitApp();
|
||||
MainMenu mainMenu = app.getStateManager().getState(MainMenu.class);
|
||||
mainMenu.showMenu();
|
||||
mainMenu.exitGame();
|
||||
assertTrue(app.isClosed());
|
||||
}
|
||||
|
||||
// T005 UC-game-05 - testOpenSettingsFromMenu
|
||||
@Test
|
||||
public void testOpenSettingsFromMenu() {
|
||||
MonopolyApp app = new MonopolyApp();
|
||||
app.simpleInitApp();
|
||||
MainMenu mainMenu = app.getStateManager().getState(MainMenu.class);
|
||||
mainMenu.showMenu();
|
||||
mainMenu.openSettings();
|
||||
SettingMenu settingMenu = app.getStateManager().getState(SettingMenu.class);
|
||||
assertNotNull(settingMenu);
|
||||
}
|
||||
|
||||
// T006 UC-game-06 - testOpenGameMenuWithESC
|
||||
@Test
|
||||
public void testOpenGameMenuWithESC() {
|
||||
MonopolyApp app = new MonopolyApp();
|
||||
app.simpleInitApp();
|
||||
app.simpleUpdate(0.1f);
|
||||
GameMenu gameMenu = app.getStateManager().getState(GameMenu.class);
|
||||
assertTrue(gameMenu.isVisible());
|
||||
}
|
||||
|
||||
// T007 UC-game-07 - testEnterHostName
|
||||
@Test
|
||||
public void testEnterHostName() {
|
||||
MonopolyApp app = new MonopolyApp();
|
||||
app.simpleInitApp();
|
||||
NewGameMenu newGameMenu = app.getStateManager().getState(NewGameMenu.class);
|
||||
newGameMenu.showMenu();
|
||||
newGameMenu.enterHostName("localhost");
|
||||
assertEquals("localhost", newGameMenu.getHostName());
|
||||
}
|
||||
|
||||
// T008 UC-game-07 - testEnterPortNumber
|
||||
@Test
|
||||
public void testEnterPortNumber() {
|
||||
MonopolyApp app = new MonopolyApp();
|
||||
app.simpleInitApp();
|
||||
NewGameMenu newGameMenu = app.getStateManager().getState(NewGameMenu.class);
|
||||
newGameMenu.showMenu();
|
||||
newGameMenu.enterPortNumber(12345);
|
||||
assertEquals(12345, newGameMenu.getPortNumber());
|
||||
}
|
||||
|
||||
// T009 UC-game-07 - testCancelGameCreation
|
||||
@Test
|
||||
public void testCancelGameCreation() {
|
||||
MonopolyApp app = new MonopolyApp();
|
||||
app.simpleInitApp();
|
||||
NewGameMenu newGameMenu = app.getStateManager().getState(NewGameMenu.class);
|
||||
newGameMenu.showMenu();
|
||||
newGameMenu.cancel();
|
||||
MainMenu mainMenu = app.getStateManager().getState(MainMenu.class);
|
||||
assertTrue(mainMenu.isMenuVisible());
|
||||
}
|
||||
|
||||
// T010 UC-game-08 - testEnterPlayerLobby
|
||||
@Test
|
||||
public void testEnterPlayerLobby() {
|
||||
MonopolyApp app = new MonopolyApp();
|
||||
app.simpleInitApp();
|
||||
app.getStateManager().getState(NetworkDialog.class).connect();
|
||||
Lobby lobby = app.getStateManager().getState(Lobby.class);
|
||||
assertNotNull(lobby);
|
||||
}
|
||||
|
||||
// T011 UC-game-09 - testEnterStartingCapital
|
||||
@Test
|
||||
public void testEnterStartingCapital() {
|
||||
MonopolyApp app = new MonopolyApp();
|
||||
app.simpleInitApp();
|
||||
NewGameMenu newGameMenu = app.getStateManager().getState(NewGameMenu.class);
|
||||
newGameMenu.showMenu();
|
||||
newGameMenu.enterStartingCapital(1500);
|
||||
assertEquals(1500, newGameMenu.getStartingCapital());
|
||||
}
|
||||
|
||||
// T012 UC-game-09 - testIncreaseStartingCapital
|
||||
@Test
|
||||
public void testIncreaseStartingCapital() {
|
||||
MonopolyApp app = new MonopolyApp();
|
||||
app.simpleInitApp();
|
||||
NewGameMenu newGameMenu = app.getStateManager().getState(NewGameMenu.class);
|
||||
newGameMenu.showMenu();
|
||||
newGameMenu.enterStartingCapital(1500);
|
||||
newGameMenu.increaseStartingCapital(100);
|
||||
assertEquals(1600, newGameMenu.getStartingCapital());
|
||||
}
|
||||
|
||||
// T013 UC-game-09 - testDecreaseStartingCapital
|
||||
@Test
|
||||
public void testDecreaseStartingCapital() {
|
||||
MonopolyApp app = new MonopolyApp();
|
||||
app.simpleInitApp();
|
||||
NewGameMenu newGameMenu = app.getStateManager().getState(NewGameMenu.class);
|
||||
newGameMenu.showMenu();
|
||||
newGameMenu.enterStartingCapital(1500);
|
||||
newGameMenu.decreaseStartingCapital(100);
|
||||
assertEquals(1400, newGameMenu.getStartingCapital());
|
||||
}
|
||||
|
||||
// T014 UC-game-10 - testDefaultPlayerName
|
||||
@Test
|
||||
public void testDefaultPlayerName() {
|
||||
MonopolyApp app = new MonopolyApp();
|
||||
app.simpleInitApp();
|
||||
app.getStateManager().getState(Lobby.class).initializePlayerNames();
|
||||
assertEquals("Spieler 1", app.getStateManager().getState(Lobby.class).getPlayerName(0));
|
||||
assertEquals("Spieler 2", app.getStateManager().getState(Lobby.class).getPlayerName(1));
|
||||
}
|
||||
|
||||
// T015 UC-game-11 - testEnterDisplayName
|
||||
@Test
|
||||
public void testEnterDisplayName() {
|
||||
MonopolyApp app = new MonopolyApp();
|
||||
app.simpleInitApp();
|
||||
Lobby lobby = app.getStateManager().getState(Lobby.class);
|
||||
lobby.enterDisplayName("TestPlayer");
|
||||
assertEquals("TestPlayer", lobby.getPlayerName(0));
|
||||
}
|
||||
|
||||
// T016 UC-game-11 - testDuplicateNameEntry
|
||||
@Test
|
||||
public void testDuplicateNameEntry() {
|
||||
MonopolyApp app = new MonopolyApp();
|
||||
app.simpleInitApp();
|
||||
Lobby lobby = app.getStateManager().getState(Lobby.class);
|
||||
lobby.enterDisplayName("Player1");
|
||||
assertTrue(lobby.isDuplicateName("Player1"));
|
||||
}
|
||||
|
||||
// T017 UC-game-12 - testSelectPlayerColor
|
||||
@Test
|
||||
public void testSelectPlayerColor() {
|
||||
MonopolyApp app = new MonopolyApp();
|
||||
app.simpleInitApp();
|
||||
Lobby lobby = app.getStateManager().getState(Lobby.class);
|
||||
lobby.selectColor("Red");
|
||||
assertEquals("Red", lobby.getPlayerColor(0));
|
||||
}
|
||||
|
||||
// T018 UC-game-12 - testSelectOccupiedColor
|
||||
@Test
|
||||
public void testSelectOccupiedColor() {
|
||||
MonopolyApp app = new MonopolyApp();
|
||||
app.simpleInitApp();
|
||||
Lobby lobby = app.getStateManager().getState(Lobby.class);
|
||||
lobby.selectColor("Red");
|
||||
assertTrue(lobby.isColorOccupied("Red"));
|
||||
}
|
||||
|
||||
// T019 UC-game-13 - testSelectPlayerToken
|
||||
@Test
|
||||
public void testSelectPlayerToken() {
|
||||
MonopolyApp app = new MonopolyApp();
|
||||
app.simpleInitApp();
|
||||
Lobby lobby = app.getStateManager().getState(Lobby.class);
|
||||
lobby.selectToken("Ship");
|
||||
assertEquals("Ship", lobby.getPlayerToken(0));
|
||||
}
|
||||
|
||||
// T020 UC-game-13 - testSelectOccupiedToken
|
||||
@Test
|
||||
public void testSelectOccupiedToken() {
|
||||
MonopolyApp app = new MonopolyApp();
|
||||
app.simpleInitApp();
|
||||
Lobby lobby = app.getStateManager().getState(Lobby.class);
|
||||
lobby.selectToken("Ship");
|
||||
assertTrue(lobby.isTokenOccupied("Ship"));
|
||||
}
|
||||
|
||||
// T021 UC-game-14 - testCancelPlayerLobby
|
||||
@Test
|
||||
public void testCancelPlayerLobby() {
|
||||
MonopolyApp app = new MonopolyApp();
|
||||
app.simpleInitApp();
|
||||
Lobby lobby = app.getStateManager().getState(Lobby.class);
|
||||
lobby.cancel();
|
||||
MainMenu mainMenu = app.getStateManager().getState(MainMenu.class);
|
||||
assertTrue(mainMenu.isMenuVisible());
|
||||
}
|
||||
|
||||
// T022 UC-game-15 - testOpenLobbyMenuWithESC
|
||||
@Test
|
||||
public void testOpenLobbyMenuWithESC() {
|
||||
MonopolyApp app = new MonopolyApp();
|
||||
app.simpleInitApp();
|
||||
app.simpleUpdate(0.1f);
|
||||
LobbyMenu lobbyMenu = app.getStateManager().getState(LobbyMenu.class);
|
||||
assertTrue(lobbyMenu.isVisible());
|
||||
}
|
||||
|
||||
// T023 UC-game-16 - testPlayerReadyConfirmation
|
||||
@Test
|
||||
public void testPlayerReadyConfirmation() {
|
||||
MonopolyApp app = new MonopolyApp();
|
||||
app.simpleInitApp();
|
||||
Lobby lobby = app.getStateManager().getState(Lobby.class);
|
||||
lobby.setPlayerReady(true);
|
||||
assertTrue(lobby.isPlayerReady(0));
|
||||
}
|
||||
|
||||
// T024 UC-game-17 - testStartGame
|
||||
@Test
|
||||
public void testStartGame() {
|
||||
MonopolyApp app = new MonopolyApp();
|
||||
app.simpleInitApp();
|
||||
Lobby lobby = app.getStateManager().getState(Lobby.class);
|
||||
lobby.startGame();
|
||||
assertEquals(GameState.InGame, lobby.getGameState());
|
||||
}
|
||||
|
||||
// T025 UC-game-18 - testPlayerMovement
|
||||
@Test
|
||||
public void testPlayerMovement() {
|
||||
MonopolyApp app = new MonopolyApp();
|
||||
app.simpleInitApp();
|
||||
Game game = app.getStateManager().getState(Game.class);
|
||||
Player player = game.getPlayer(0);
|
||||
player.move(5);
|
||||
assertEquals(5, player.getPosition());
|
||||
}
|
||||
|
||||
// T026 UC-game-19 - testPurchaseProperty
|
||||
@Test
|
||||
public void testPurchaseProperty() {
|
||||
MonopolyApp app = new MonopolyApp();
|
||||
app.simpleInitApp();
|
||||
Game game = app.getStateManager().getState(Game.class);
|
||||
Player player = game.getPlayer(0);
|
||||
Property property = game.getProperty(0);
|
||||
player.buyProperty(property);
|
||||
assertTrue(player.getProperties().contains(property));
|
||||
}
|
||||
|
||||
// T027 UC-game-20 - testMovePlayerOnDiceRoll
|
||||
@Test
|
||||
public void testMovePlayerOnDiceRoll() {
|
||||
MonopolyApp app = new MonopolyApp();
|
||||
app.simpleInitApp();
|
||||
Game game = app.getStateManager().getState(Game.class);
|
||||
Player player = game.getPlayer(0);
|
||||
int initialPosition = player.getPosition();
|
||||
player.rollDice();
|
||||
assertTrue(player.getPosition() > initialPosition);
|
||||
}
|
||||
|
||||
// T028 UC-game-21 - testPassGo
|
||||
@Test
|
||||
public void testPassGo() {
|
||||
MonopolyApp app = new MonopolyApp();
|
||||
app.simpleInitApp();
|
||||
Game game = app.getStateManager().getState(Game.class);
|
||||
Player player = game.getPlayer(0);
|
||||
player.move(40); // Assuming 40 steps moves player to Go
|
||||
assertTrue(player.passedGo());
|
||||
}
|
||||
|
||||
// T029 UC-game-22 - testCollectMoneyFromGo
|
||||
@Test
|
||||
public void testCollectMoneyFromGo() {
|
||||
MonopolyApp app = new MonopolyApp();
|
||||
app.simpleInitApp();
|
||||
Game game = app.getStateManager().getState(Game.class);
|
||||
Player player = game.getPlayer(0);
|
||||
int initialBalance = player.getBalance();
|
||||
player.move(40); // Move to Go
|
||||
assertTrue(player.getBalance() > initialBalance);
|
||||
}
|
||||
|
||||
// T030 UC-game-23 - testPayRent
|
||||
@Test
|
||||
public void testPayRent() {
|
||||
MonopolyApp app = new MonopolyApp();
|
||||
app.simpleInitApp();
|
||||
Game game = app.getStateManager().getState(Game.class);
|
||||
Player player = game.getPlayer(0);
|
||||
PropertyField property = (PropertyField) game.getField(1);
|
||||
player.move(1);
|
||||
int initialBalance = player.getBalance();
|
||||
player.payRent(property);
|
||||
assertTrue(player.getBalance() < initialBalance);
|
||||
}
|
||||
|
||||
// T031 UC-game-24 - testDeclareBankruptcy
|
||||
@Test
|
||||
public void testDeclareBankruptcy() {
|
||||
MonopolyApp app = new MonopolyApp();
|
||||
app.simpleInitApp();
|
||||
Game game = app.getStateManager().getState(Game.class);
|
||||
Player player = game.getPlayer(0);
|
||||
player.declareBankruptcy();
|
||||
assertEquals(PlayerState.Bankrupt, player.getState());
|
||||
}
|
||||
|
||||
// T032 UC-game-25 - testTradeProperty
|
||||
@Test
|
||||
public void testTradeProperty() {
|
||||
MonopolyApp app = new MonopolyApp();
|
||||
app.simpleInitApp();
|
||||
Game game = app.getStateManager().getState(Game.class);
|
||||
Player player1 = game.getPlayer(0);
|
||||
Player player2 = game.getPlayer(1);
|
||||
Property property = game.getProperty(0);
|
||||
player1.offerTrade(player2, property);
|
||||
assertTrue(player2.hasProperty(property));
|
||||
}
|
||||
|
||||
// T033 UC-game-26 - testGameOverCondition
|
||||
@Test
|
||||
public void testGameOverCondition() {
|
||||
MonopolyApp app = new MonopolyApp();
|
||||
app.simpleInitApp();
|
||||
Game game = app.getStateManager().getState(Game.class);
|
||||
Player player = game.getPlayer(0);
|
||||
player.declareBankruptcy();
|
||||
assertTrue(game.isGameOver());
|
||||
}
|
||||
|
||||
// T034 UC-game-27 - testPlayerInJail
|
||||
@Test
|
||||
public void testPlayerInJail() {
|
||||
MonopolyApp app = new MonopolyApp();
|
||||
app.simpleInitApp();
|
||||
Game game = app.getStateManager().getState(Game.class);
|
||||
Player player = game.getPlayer(0);
|
||||
game.sendToJail(player);
|
||||
assertEquals(PlayerState.InJail, player.getState());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
*/
|
@ -1,11 +1,13 @@
|
||||
package pp.monopoly.client;
|
||||
|
||||
import com.jme3.scene.Spatial;
|
||||
import com.simsilica.lemur.Button;
|
||||
import com.jme3.scene.Node;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
public class ClientLogicTest {
|
||||
@ -41,7 +43,7 @@ public class ClientLogicTest {
|
||||
|
||||
@Test
|
||||
// T002: UC-game-02 - Überprüft, ob das Startmenü nach dem Start der Anwendung angezeigt wird
|
||||
public void testOpenStartMenu() {
|
||||
public void testOpenStartMenu1() {
|
||||
// Mock des Startmenü-Kindes
|
||||
Spatial startMenuMock = mock(Spatial.class);
|
||||
when(guiNodeMock.getChild("StartMenu")).thenReturn(startMenuMock);
|
||||
@ -53,7 +55,7 @@ public class ClientLogicTest {
|
||||
|
||||
@Test
|
||||
// T003: UC-game-03 - Überprüft, ob der „Spiel starten“-Button das Spielerstellungsmenü öffnet
|
||||
public void testNavigateToPlayOption() {
|
||||
public void testNavigateToPlayOption1() {
|
||||
// Mock des Spielerstellungsmenü-Kindes
|
||||
Spatial playMenuMock = mock(Spatial.class);
|
||||
when(guiNodeMock.getChild("PlayMenu")).thenReturn(playMenuMock);
|
||||
@ -65,7 +67,7 @@ public class ClientLogicTest {
|
||||
|
||||
@Test
|
||||
// T004: UC-game-04 - Testet, ob die Anwendung geschlossen wird, wenn „Beenden“ im Hauptmenü gewählt wird
|
||||
public void testExitApplicationFromMenu() {
|
||||
public void testExitApplicationFromMenu1() {
|
||||
// Simuliere den Schließen-Aufruf
|
||||
doNothing().when(app).closeApp();
|
||||
|
||||
@ -78,7 +80,7 @@ public class ClientLogicTest {
|
||||
|
||||
@Test
|
||||
// T005: UC-game-05 - Überprüft, ob das Einstellungen-Menü aus dem Hauptmenü aufgerufen werden kann
|
||||
public void testOpenSettingsFromMenu() {
|
||||
public void testOpenSettingsFromMenu1() {
|
||||
// Mock des Einstellungsmenü-Kindes
|
||||
Spatial settingsMenuMock = mock(Spatial.class);
|
||||
when(guiNodeMock.getChild("SettingsMenu")).thenReturn(settingsMenuMock);
|
||||
@ -90,72 +92,72 @@ public class ClientLogicTest {
|
||||
|
||||
@Test
|
||||
// T006: UC-game-06 - Testet, ob das Spielmenü geöffnet wird, wenn der Spieler im Spiel „ESC“ drückt
|
||||
public void testOpenGameMenuWithESC() {
|
||||
public void testOpenGameMenuWithESC1() {
|
||||
// Simuliere den ESC-Tastendruck
|
||||
doNothing().when(app).handleEscape(true);
|
||||
doNothing().when(app).escape(true);
|
||||
|
||||
// Rufe die ESC-Tastenmethode auf
|
||||
app.handleEscape(true);
|
||||
app.escape(true);
|
||||
|
||||
// Verifiziere, dass die Methode aufgerufen wurde
|
||||
verify(app, times(1)).handleEscape(true);
|
||||
verify(app, times(1)).escape(true);
|
||||
}
|
||||
}
|
||||
/*
|
||||
|
||||
|
||||
@Test
|
||||
// T002: UC-game-02 - Überprüft, ob das Startmenü nach dem Start der Anwendung angezeigt wird
|
||||
public void testOpenStartMenu() {
|
||||
Spatial startMenu = app.getGuiNode().getChild("StartMenu");
|
||||
assertNotNull("Das Startmenü sollte sichtbar sein", startMenu);
|
||||
}
|
||||
*/
|
||||
/*
|
||||
@Test
|
||||
// T002: UC-game-02 - Überprüft, ob das Startmenü (MainMenu) angezeigt wird und die Buttons korrekt funktionieren
|
||||
public void testMainMenuButtons() {
|
||||
Spatial mainMenu = app.getGuiNode().getChild("MainMenu");
|
||||
assertNotNull("Das Hauptmenü (MainMenu) sollte sichtbar sein", mainMenu);
|
||||
|
||||
Spatial playButtonSpatial = app.getGuiNode().getChild("PlayButton");
|
||||
assertNotNull("Der 'Spielen'-Button sollte existieren", playButtonSpatial);
|
||||
|
||||
Spatial settingsButtonSpatial = app.getGuiNode().getChild("SettingsButton");
|
||||
assertNotNull("Der 'Einstellungen'-Button sollte existieren", settingsButtonSpatial);
|
||||
@Test
|
||||
// T002: UC-game-02 - Überprüft, ob das Startmenü (MainMenu) angezeigt wird und die Buttons korrekt funktionieren
|
||||
public void testMainMenuButtons() {
|
||||
Spatial mainMenu = app.getGuiNode().getChild("MainMenu");
|
||||
assertNotNull("Das Hauptmenü (MainMenu) sollte sichtbar sein", mainMenu);
|
||||
|
||||
Spatial exitButtonSpatial = app.getGuiNode().getChild("ExitButton");
|
||||
assertNotNull("Der 'Spiel beenden'-Button sollte existieren", exitButtonSpatial);
|
||||
Spatial playButtonSpatial = app.getGuiNode().getChild("PlayButton");
|
||||
assertNotNull("Der 'Spielen'-Button sollte existieren", playButtonSpatial);
|
||||
|
||||
// Optional: Überprüfung der Funktionalität (Simulation von Button-Klicks)
|
||||
if (playButtonSpatial instanceof Button) {
|
||||
Button playButton = (Button) playButtonSpatial;
|
||||
playButton.click();
|
||||
Spatial settingsButtonSpatial = app.getGuiNode().getChild("SettingsButton");
|
||||
assertNotNull("Der 'Einstellungen'-Button sollte existieren", settingsButtonSpatial);
|
||||
|
||||
Spatial newGameMenu = app.getGuiNode().getChild("NewGameMenu");
|
||||
assertNotNull("Das Spielerstellungsmenü sollte nach dem Klicken auf 'Spielen' sichtbar sein", newGameMenu);
|
||||
} else {
|
||||
throw new AssertionError("'PlayButton' ist kein Button-Objekt.");
|
||||
Spatial exitButtonSpatial = app.getGuiNode().getChild("ExitButton");
|
||||
assertNotNull("Der 'Spiel beenden'-Button sollte existieren", exitButtonSpatial);
|
||||
|
||||
// Optional: Überprüfung der Funktionalität (Simulation von Button-Klicks)
|
||||
if (playButtonSpatial instanceof Button) {
|
||||
Button playButton = (Button) playButtonSpatial;
|
||||
playButton.click();
|
||||
|
||||
Spatial newGameMenu = app.getGuiNode().getChild("NewGameMenu");
|
||||
assertNotNull("Das Spielerstellungsmenü sollte nach dem Klicken auf 'Spielen' sichtbar sein", newGameMenu);
|
||||
} else {
|
||||
throw new AssertionError("'PlayButton' ist kein Button-Objekt.");
|
||||
}
|
||||
|
||||
if (settingsButtonSpatial instanceof Button) {
|
||||
Button settingsButton = (Button) settingsButtonSpatial;
|
||||
settingsButton.click();
|
||||
|
||||
Spatial settingsMenu = app.getGuiNode().getChild("SettingsMenu");
|
||||
assertNotNull("Das Einstellungsmenü sollte nach dem Klicken auf 'Einstellungen' sichtbar sein", settingsMenu);
|
||||
} else {
|
||||
throw new AssertionError("'SettingsButton' ist kein Button-Objekt.");
|
||||
}
|
||||
|
||||
if (exitButtonSpatial instanceof Button) {
|
||||
Button exitButton = (Button) exitButtonSpatial;
|
||||
exitButton.click();
|
||||
|
||||
Spatial mainMenuAfterExit = app.getGuiNode().getChild("MainMenu");
|
||||
assertNull("Das Hauptmenü sollte nach dem Klicken auf 'Spiel beenden' nicht mehr sichtbar sein", mainMenuAfterExit);
|
||||
} else {
|
||||
throw new AssertionError("'ExitButton' ist kein Button-Objekt.");
|
||||
}
|
||||
}
|
||||
|
||||
if (settingsButtonSpatial instanceof Button) {
|
||||
Button settingsButton = (Button) settingsButtonSpatial;
|
||||
settingsButton.click();
|
||||
|
||||
Spatial settingsMenu = app.getGuiNode().getChild("SettingsMenu");
|
||||
assertNotNull("Das Einstellungsmenü sollte nach dem Klicken auf 'Einstellungen' sichtbar sein", settingsMenu);
|
||||
} else {
|
||||
throw new AssertionError("'SettingsButton' ist kein Button-Objekt.");
|
||||
}
|
||||
|
||||
if (exitButtonSpatial instanceof Button) {
|
||||
Button exitButton = (Button) exitButtonSpatial;
|
||||
exitButton.click();
|
||||
|
||||
Spatial mainMenuAfterExit = app.getGuiNode().getChild("MainMenu");
|
||||
assertNull("Das Hauptmenü sollte nach dem Klicken auf 'Spiel beenden' nicht mehr sichtbar sein", mainMenuAfterExit);
|
||||
} else {
|
||||
throw new AssertionError("'ExitButton' ist kein Button-Objekt.");
|
||||
}
|
||||
}
|
||||
@Test
|
||||
// T003: UC-game-03 - Überprüft, ob der „Spiel starten“-Button das Spielerstellungsmenü öffnet
|
||||
public void testNavigateToPlayOption() {
|
||||
@ -236,4 +238,3 @@ public void testMainMenuButtons() {
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
@ -1,5 +1,5 @@
|
||||
package pp.monopoly.game.client;
|
||||
/*
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.mockito.Mock;
|
||||
@ -14,7 +14,6 @@ import static org.mockito.Mockito.*;
|
||||
/**
|
||||
* Tests the client-side logic of the Monopoly game.
|
||||
*/
|
||||
/*
|
||||
public class ClientGameLogicTest {
|
||||
|
||||
private ClientGameLogic logic;
|
||||
@ -120,4 +119,3 @@ public class ClientGameLogicTest {
|
||||
assertTrue("The player should be able to select an available color.", result);
|
||||
}
|
||||
}
|
||||
*/
|
File diff suppressed because it is too large
Load Diff
@ -1,9 +0,0 @@
|
||||
package pp.monopoly.model;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
public class RandomPositionIteratorTest {
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user