mirror of
				https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
				synced 2025-11-04 13:56:22 +01:00 
			
		
		
		
	Compare commits
	
		
			3 Commits
		
	
	
		
			be568fd8f2
			...
			main
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					4cdd7c0cab | ||
| 
						 | 
					e66487776d | ||
| 
						 | 
					97397e3053 | 
							
								
								
									
										
											BIN
										
									
								
								Dokumente/Vostellung_PP_Gruppe2_Monopoly.pptx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Dokumente/Vostellung_PP_Gruppe2_Monopoly.pptx
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							@@ -1,239 +0,0 @@
 | 
				
			|||||||
package pp.monopoly.client;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import com.jme3.scene.Spatial;
 | 
					 | 
				
			||||||
import com.jme3.scene.Node;
 | 
					 | 
				
			||||||
import org.junit.Before;
 | 
					 | 
				
			||||||
import org.junit.Test;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import static org.junit.Assert.assertNotNull;
 | 
					 | 
				
			||||||
import static org.mockito.Mockito.*;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
public class ClientLogicTest {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    private MonopolyApp app;
 | 
					 | 
				
			||||||
    private Node guiNodeMock;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Before
 | 
					 | 
				
			||||||
    public void setUp() {
 | 
					 | 
				
			||||||
        // Erstelle eine Mock-Instanz der MonopolyApp
 | 
					 | 
				
			||||||
        app = spy(new MonopolyApp());
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        // Mock GuiNode
 | 
					 | 
				
			||||||
        guiNodeMock = mock(Node.class);
 | 
					 | 
				
			||||||
        doReturn(guiNodeMock).when(app).getGuiNode();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        // Initialisiere die App
 | 
					 | 
				
			||||||
        doNothing().when(app).simpleInitApp();
 | 
					 | 
				
			||||||
        app.simpleInitApp();
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Test
 | 
					 | 
				
			||||||
    // T001: UC-game-01 - Überprüft, ob die Anwendung erfolgreich gestartet wird und das Hauptmenü angezeigt wird
 | 
					 | 
				
			||||||
    public void testStartApplication() {
 | 
					 | 
				
			||||||
        // Mock des Hauptmenü-Kindes
 | 
					 | 
				
			||||||
        Spatial mainMenuMock = mock(Spatial.class);
 | 
					 | 
				
			||||||
        when(guiNodeMock.getChild("MainMenu")).thenReturn(mainMenuMock);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        // Test, ob das Hauptmenü angezeigt wird
 | 
					 | 
				
			||||||
        Spatial mainMenu = app.getGuiNode().getChild("MainMenu");
 | 
					 | 
				
			||||||
        assertNotNull("Das Hauptmenü sollte sichtbar sein", mainMenu);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Test
 | 
					 | 
				
			||||||
    // T002: UC-game-02 - Überprüft, ob das Startmenü nach dem Start der Anwendung angezeigt wird
 | 
					 | 
				
			||||||
    public void testOpenStartMenu() {
 | 
					 | 
				
			||||||
        // Mock des Startmenü-Kindes
 | 
					 | 
				
			||||||
        Spatial startMenuMock = mock(Spatial.class);
 | 
					 | 
				
			||||||
        when(guiNodeMock.getChild("StartMenu")).thenReturn(startMenuMock);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        // Test, ob das Startmenü angezeigt wird
 | 
					 | 
				
			||||||
        Spatial startMenu = app.getGuiNode().getChild("StartMenu");
 | 
					 | 
				
			||||||
        assertNotNull("Das Startmenü sollte sichtbar sein", startMenu);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Test
 | 
					 | 
				
			||||||
    // T003: UC-game-03 - Überprüft, ob der „Spiel starten“-Button das Spielerstellungsmenü öffnet
 | 
					 | 
				
			||||||
    public void testNavigateToPlayOption() {
 | 
					 | 
				
			||||||
        // Mock des Spielerstellungsmenü-Kindes
 | 
					 | 
				
			||||||
        Spatial playMenuMock = mock(Spatial.class);
 | 
					 | 
				
			||||||
        when(guiNodeMock.getChild("PlayMenu")).thenReturn(playMenuMock);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        // Test, ob das Spielerstellungsmenü angezeigt wird
 | 
					 | 
				
			||||||
        Spatial playMenu = app.getGuiNode().getChild("PlayMenu");
 | 
					 | 
				
			||||||
        assertNotNull("Das Spielerstellungsmenü sollte sichtbar sein", playMenu);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Test
 | 
					 | 
				
			||||||
    // T004: UC-game-04 - Testet, ob die Anwendung geschlossen wird, wenn „Beenden“ im Hauptmenü gewählt wird
 | 
					 | 
				
			||||||
    public void testExitApplicationFromMenu() {
 | 
					 | 
				
			||||||
        // Simuliere den Schließen-Aufruf
 | 
					 | 
				
			||||||
        doNothing().when(app).closeApp();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        // Rufe die Schließen-Methode auf
 | 
					 | 
				
			||||||
        app.closeApp();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        // Verifiziere, dass die Methode aufgerufen wurde
 | 
					 | 
				
			||||||
        verify(app, times(1)).closeApp();
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Test
 | 
					 | 
				
			||||||
    // T005: UC-game-05 - Überprüft, ob das Einstellungen-Menü aus dem Hauptmenü aufgerufen werden kann
 | 
					 | 
				
			||||||
    public void testOpenSettingsFromMenu() {
 | 
					 | 
				
			||||||
        // Mock des Einstellungsmenü-Kindes
 | 
					 | 
				
			||||||
        Spatial settingsMenuMock = mock(Spatial.class);
 | 
					 | 
				
			||||||
        when(guiNodeMock.getChild("SettingsMenu")).thenReturn(settingsMenuMock);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        // Test, ob das Einstellungsmenü angezeigt wird
 | 
					 | 
				
			||||||
        Spatial settingsMenu = app.getGuiNode().getChild("SettingsMenu");
 | 
					 | 
				
			||||||
        assertNotNull("Das Einstellungsmenü sollte sichtbar sein", settingsMenu);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Test
 | 
					 | 
				
			||||||
    // T006: UC-game-06 - Testet, ob das Spielmenü geöffnet wird, wenn der Spieler im Spiel „ESC“ drückt
 | 
					 | 
				
			||||||
    public void testOpenGameMenuWithESC() {
 | 
					 | 
				
			||||||
        // Simuliere den ESC-Tastendruck
 | 
					 | 
				
			||||||
        doNothing().when(app).escape(true);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        // Rufe die ESC-Tastenmethode auf
 | 
					 | 
				
			||||||
        app.escape(true);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        // Verifiziere, dass die Methode aufgerufen wurde
 | 
					 | 
				
			||||||
        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);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    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.");
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
    @Test
 | 
					 | 
				
			||||||
    // T003: UC-game-03 - Überprüft, ob der „Spiel starten“-Button das Spielerstellungsmenü öffnet
 | 
					 | 
				
			||||||
    public void testNavigateToPlayOption() {
 | 
					 | 
				
			||||||
        Spatial startGameButtonSpatial = app.getGuiNode().getChild("StartGameButton");
 | 
					 | 
				
			||||||
        assertNotNull("Der 'Spiel starten'-Button sollte existieren", startGameButtonSpatial);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if (startGameButtonSpatial instanceof Button) {
 | 
					 | 
				
			||||||
            Button startGameButton = (Button) startGameButtonSpatial;
 | 
					 | 
				
			||||||
            startGameButton.click();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Spatial newGameMenu = app.getGuiNode().getChild("NewGameMenu");
 | 
					 | 
				
			||||||
            assertNotNull("Das Spielerstellungsmenü sollte sichtbar sein", newGameMenu);
 | 
					 | 
				
			||||||
        } else {
 | 
					 | 
				
			||||||
            throw new AssertionError("'StartGameButton' ist kein Button-Objekt.");
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Test
 | 
					 | 
				
			||||||
    // T004: UC-game-04 - Testet, ob die Anwendung geschlossen wird, wenn „Beenden“ im Hauptmenü gewählt wird
 | 
					 | 
				
			||||||
    public void testExitApplicationFromMenu() {
 | 
					 | 
				
			||||||
        Spatial exitButtonSpatial = app.getGuiNode().getChild("ExitButton");
 | 
					 | 
				
			||||||
        assertNotNull("Der 'Beenden'-Button sollte existieren", exitButtonSpatial);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if (exitButtonSpatial instanceof Button) {
 | 
					 | 
				
			||||||
            Button exitButton = (Button) exitButtonSpatial;
 | 
					 | 
				
			||||||
            exitButton.click();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Spatial mainMenuAfterExit = app.getGuiNode().getChild("MainMenu");
 | 
					 | 
				
			||||||
            assertNull("Das Hauptmenü sollte nach dem Beenden nicht mehr sichtbar sein", mainMenuAfterExit);
 | 
					 | 
				
			||||||
        } else {
 | 
					 | 
				
			||||||
            throw new AssertionError("'ExitButton' ist kein Button-Objekt.");
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Test
 | 
					 | 
				
			||||||
    // T005: UC-game-05 - Überprüft, ob das Einstellungen-Menü aus dem Hauptmenü aufgerufen werden kann
 | 
					 | 
				
			||||||
    public void testOpenSettingsFromMenu() {
 | 
					 | 
				
			||||||
        Spatial settingsButtonSpatial = app.getGuiNode().getChild("SettingsButton");
 | 
					 | 
				
			||||||
        assertNotNull("Der 'Einstellungen'-Button sollte existieren", settingsButtonSpatial);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if (settingsButtonSpatial instanceof Button) {
 | 
					 | 
				
			||||||
            Button settingsButton = (Button) settingsButtonSpatial;
 | 
					 | 
				
			||||||
            settingsButton.click();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Spatial settingsMenu = app.getGuiNode().getChild("SettingsMenu");
 | 
					 | 
				
			||||||
            assertNotNull("Das Einstellungsmenü sollte sichtbar sein", settingsMenu);
 | 
					 | 
				
			||||||
        } else {
 | 
					 | 
				
			||||||
            throw new AssertionError("'SettingsButton' ist kein Button-Objekt.");
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Test
 | 
					 | 
				
			||||||
    // T006: UC-game-06 - Testet, ob das Spielmenü geöffnet wird, wenn der Spieler im Spiel „ESC“ drückt
 | 
					 | 
				
			||||||
    public void testOpenGameMenuWithESC() {
 | 
					 | 
				
			||||||
        app.escape(true); // Simuliert das Drücken der ESC-Taste
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        Spatial gameMenu = app.getGuiNode().getChild("GameMenu");
 | 
					 | 
				
			||||||
        assertNotNull("Das Spielmenü sollte nach Drücken von ESC sichtbar sein", gameMenu);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        app.escape(false); // Simuliert das Loslassen der ESC-Taste
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Test
 | 
					 | 
				
			||||||
    // T083: UC-menu-05 - Überprüfen, ob der Spieler erfolgreich ins Spiel zurückkehren kann
 | 
					 | 
				
			||||||
    public void testReturnToGame() {
 | 
					 | 
				
			||||||
        Spatial returnButtonSpatial = app.getGuiNode().getChild("ReturnButton");
 | 
					 | 
				
			||||||
        assertNotNull("Der 'Zurück'-Button sollte existieren", returnButtonSpatial);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if (returnButtonSpatial instanceof Button) {
 | 
					 | 
				
			||||||
            Button returnButton = (Button) returnButtonSpatial;
 | 
					 | 
				
			||||||
            returnButton.click();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Spatial gameScene = app.getGuiNode().getChild("GameScene");
 | 
					 | 
				
			||||||
            assertNotNull("Die Spielszene sollte nach dem Klick auf 'Zurück' sichtbar sein", gameScene);
 | 
					 | 
				
			||||||
        } else {
 | 
					 | 
				
			||||||
            throw new AssertionError("'ReturnButton' ist kein Button-Objekt.");
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
*/
 | 
					 | 
				
			||||||
@@ -1,123 +0,0 @@
 | 
				
			|||||||
package pp.monopoly.game.client;
 | 
					 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
import org.junit.Before;
 | 
					 | 
				
			||||||
import org.junit.Test;
 | 
					 | 
				
			||||||
import org.mockito.Mock;
 | 
					 | 
				
			||||||
import org.mockito.MockitoAnnotations;
 | 
					 | 
				
			||||||
import pp.monopoly.server.MonopolyServer;
 | 
					 | 
				
			||||||
import pp.monopoly.client.ClientSender;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import static org.junit.Assert.assertEquals;
 | 
					 | 
				
			||||||
import static org.junit.Assert.assertTrue;
 | 
					 | 
				
			||||||
import static org.mockito.Mockito.*;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * Tests the client-side logic of the Monopoly game.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
public class ClientGameLogicTest {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    private ClientGameLogic logic;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Mock
 | 
					 | 
				
			||||||
    private MonopolyServer serverMock;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Mock
 | 
					 | 
				
			||||||
    private ClientSender clientSenderMock;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Before
 | 
					 | 
				
			||||||
    public void setUp() {
 | 
					 | 
				
			||||||
        MockitoAnnotations.openMocks(this);
 | 
					 | 
				
			||||||
        logic = new ClientGameLogic(clientSenderMock);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Test
 | 
					 | 
				
			||||||
    public void testEnterHostName() {
 | 
					 | 
				
			||||||
        String hostName = "localhost";
 | 
					 | 
				
			||||||
        logic.setHostName(hostName);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        assertEquals("The hostname should be correctly set.", hostName, logic.getHostName());
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Test
 | 
					 | 
				
			||||||
    public void testEnterPortNumber() {
 | 
					 | 
				
			||||||
        int portNumber = 12345;
 | 
					 | 
				
			||||||
        logic.setPortNumber(portNumber);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        assertEquals("The port number should be correctly set.", portNumber, logic.getPortNumber());
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Test
 | 
					 | 
				
			||||||
    public void testCancelGameCreation() {
 | 
					 | 
				
			||||||
        doNothing().when(clientSenderMock).returnToMainMenu();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        logic.cancelGameCreation();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        verify(clientSenderMock, times(1)).returnToMainMenu();
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Test
 | 
					 | 
				
			||||||
    public void testEnterPlayerLobby() {
 | 
					 | 
				
			||||||
        doNothing().when(clientSenderMock).enterLobby();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        logic.enterLobby();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        verify(clientSenderMock, times(1)).enterLobby();
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Test
 | 
					 | 
				
			||||||
    public void testEnterStartingCapital() {
 | 
					 | 
				
			||||||
        int startingCapital = 1500;
 | 
					 | 
				
			||||||
        logic.setStartingCapital(startingCapital);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        assertEquals("The starting capital should be correctly set.", startingCapital, logic.getStartingCapital());
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Test
 | 
					 | 
				
			||||||
    public void testIncreaseStartingCapital() {
 | 
					 | 
				
			||||||
        logic.setStartingCapital(1500);
 | 
					 | 
				
			||||||
        logic.increaseStartingCapital();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        assertEquals("The starting capital should increase by 100.", 1600, logic.getStartingCapital());
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Test
 | 
					 | 
				
			||||||
    public void testDecreaseStartingCapital() {
 | 
					 | 
				
			||||||
        logic.setStartingCapital(1500);
 | 
					 | 
				
			||||||
        logic.decreaseStartingCapital();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        assertEquals("The starting capital should decrease by 100.", 1400, logic.getStartingCapital());
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Test
 | 
					 | 
				
			||||||
    public void testDefaultPlayerName() {
 | 
					 | 
				
			||||||
        logic.addPlayer("Player 1");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        assertTrue("The player name should be correctly set.", logic.getPlayerNames().contains("Player 1"));
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Test
 | 
					 | 
				
			||||||
    public void testEnterDisplayName() {
 | 
					 | 
				
			||||||
        String displayName = "JohnDoe";
 | 
					 | 
				
			||||||
        logic.setPlayerName(displayName);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        assertEquals("The display name should be correctly set.", displayName, logic.getPlayerName());
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Test
 | 
					 | 
				
			||||||
    public void testDuplicateNameEntry() {
 | 
					 | 
				
			||||||
        logic.addPlayer("Player 1");
 | 
					 | 
				
			||||||
        boolean result = logic.addPlayer("Player 1");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        assertTrue("Duplicate names should not be allowed.", !result);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Test
 | 
					 | 
				
			||||||
    public void testSelectPlayerColor() {
 | 
					 | 
				
			||||||
        logic.addPlayer("Player 1");
 | 
					 | 
				
			||||||
        boolean result = logic.setPlayerColor("Player 1", "Red");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        assertTrue("The player should be able to select an available color.", result);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
*/
 | 
					 | 
				
			||||||
		Reference in New Issue
	
	Block a user