12 Commits

Author SHA1 Message Date
Filip Szepielewicz
a9e4afec08 Update 2 files
- /Projekte/monopoly/model/src/test/java/pp/monopoly/Testhandbuch.java
- /Projekte/monopoly/model/src/test/java/pp/monopoly/game/server/ServerGameLogicTest.java
2024-11-28 20:08:07 +00:00
Johannes Schmelz
6e5d9452b3 Merge branch 'main' into 'Testhandbuch'
# Conflicts:
#   Projekte/jme-common/src/main/resources/Interface/Lemur/pp-styles.groovy
#   Projekte/monopoly/client/src/main/java/pp/monopoly/client/MonopolyApp.java
#   Projekte/monopoly/model/src/test/java/pp/monopoly/client/ClientLogicTest.java
#   Projekte/monopoly/model/src/test/java/pp/monopoly/game/client/ClientGameLogicTest.java
2024-11-25 04:32:59 +00:00
Filip Szepielewicz
f1d52c445b Tests bis T075 überarbeitet 2024-11-22 21:45:22 +01:00
Johannes Schmelz
b85bbdd0ad updates gitignore for vscode 2024-11-19 21:29:48 +01:00
Filip Szepielewicz
30e4298f88 Merge remote-tracking branch 'origin/Testhandbuch' into Testhandbuch 2024-11-17 20:38:30 +01:00
Filip Szepielewicz
7a9e84f49c Tests bis T071 erweitert 2024-11-17 20:06:47 +01:00
Filip Szepielewicz
7fce07ac19 Tests bis T070 erweitert 2024-11-17 20:00:05 +01:00
Johannes Schmelz
2496ad812a Merge branch 'main' into 'Testhandbuch'
# Conflicts:
#   Projekte/monopoly/model/src/test/java/pp/monopoly/Testhandbuch.java
2024-11-17 18:27:54 +00:00
Filip Szepielewicz
f4fb04d17e T001 - T037 überarbeitet 2024-11-15 19:46:26 +01:00
Filip Szepielewicz
1b4fee2853 T001 - T034 erster versuch 2024-11-15 08:42:56 +01:00
Filip Szepielewicz
b65f458302 T001 - T034 erster versuch 2024-11-15 08:42:11 +01:00
Filip Szepielewicz
c792a8b3fb T001 - T034 erster versuch 2024-11-14 21:58:47 +01:00
20 changed files with 2137 additions and 1175 deletions

1
.gitignore vendored
View File

@@ -4,6 +4,7 @@ build
# VSC
bin
.vscode
# IntelliJ
*.iml

View File

@@ -7,22 +7,21 @@
package pp.battleship.client;
import java.io.File;
import java.io.IOException;
import java.util.prefs.Preferences;
import com.simsilica.lemur.Button;
import com.simsilica.lemur.Checkbox;
import com.simsilica.lemur.Label;
import com.simsilica.lemur.style.ElementId;
import static pp.battleship.Resources.lookup;
import pp.battleship.client.gui.GameMusic;
import pp.battleship.client.gui.VolumeSlider;
import pp.dialog.Dialog;
import pp.dialog.StateCheckboxModel;
import pp.dialog.TextInputDialog;
import java.io.File;
import java.io.IOException;
import java.util.prefs.Preferences;
import static pp.battleship.Resources.lookup;
import static pp.util.PreferencesUtils.getPreferences;
/**
@@ -39,7 +38,7 @@ class Menu extends Dialog {
private final VolumeSlider slider;
/**
* Constructs the Menu dialog for the Battleship application.
* Constructs the Menu dialog for the Battleship application.+
*
* @param app the BattleshipApp instance
*/

View File

@@ -1,6 +1,5 @@
// Styling of Lemur components
// For documentation, see:
// For documentation, see:
// https://github.com/jMonkeyEngine-Contributions/Lemur/wiki/Styling
import com.simsilica.lemur.*
import com.simsilica.lemur.component.QuadBackgroundComponent
@@ -10,6 +9,7 @@ import com.simsilica.lemur.Command
import com.simsilica.lemur.HAlignment
import com.simsilica.lemur.Insets3f
import com.simsilica.lemur.component.QuadBackgroundComponent
import com.simsilica.lemur.component.TbtQuadBackgroundComponent
def bgColor = color(1, 1, 1, 1)
def buttonEnabledColor = color(0, 0, 0, 1)
@@ -17,15 +17,17 @@ def buttonDisabledColor = color(0.8, 0.9, 1, 0.2)
def buttonBgColor = color(1, 1, 1, 1)
def sliderColor = color(0.6, 0.8, 0.8, 1)
def sliderBgColor = color(0.5, 0.75, 0.75, 1)
def gradientColor = color(1, 1, 1, 1)
def gradientColor = color(0.5, 0.75, 0.85, 0.5)
def tabbuttonEnabledColor = color(0.4, 0.45, 0.5, 1)
def solidWhiteBackground = new QuadBackgroundComponent(color(1, 1, 1, 1)) // Solid white
def gradient = TbtQuadBackgroundComponent.create(
texture(name: "/com/simsilica/lemur/icons/bordered-gradient.png", generateMips: false),
1, 1, 1, 126, 126, 1f, false)
texture(name: "/com/simsilica/lemur/icons/bordered-gradient.png",
generateMips: false),
1, 1, 1, 126, 126,
1f, false)
def doubleGradient = new QuadBackgroundComponent(gradientColor)
doubleGradient.texture = texture(name: "/com/simsilica/lemur/icons/double-gradient-128.png",
@@ -42,24 +44,42 @@ selector("pp") {
font = font("Interface/Fonts/Metropolis/Metropolis-Regular-32.fnt")
}
// Titel für "Einstellungen"
selector("settings-title", "pp") {
color = color(1, 1, 1, 1)
fontSize = 48
textHAlignment = HAlignment.Center
insets = new Insets3f(5, 5, 5, 5)
selector("label", "pp") {
insets = new Insets3f(2, 2, 2, 2)
color = buttonEnabledColor
}
selector("header", "pp") {
font = font("Interface/Fonts/Metropolis/Metropolis-Bold-42.fnt")
insets = new Insets3f(2, 2, 2, 2)
color = color(1, 0.5, 0, 1)
textHAlignment = HAlignment.Center
}
// Container Stil
selector("container", "pp") {
background = solidWhiteBackground.clone()
background.setColor(bgColor)
}
// Slider Stil
selector("toolbar") {
// Set the grey background
background = new QuadBackgroundComponent(greyBackground)
// Add a red border using a TbtQuadBackgroundComponent
def redBorder = TbtQuadBackgroundComponent.create(
texture(name: "/com/simsilica/lemur/icons/bordered-gradient.png",
generateMips: false),
1, 1, 1, 1, 1,
1f, false)
redBorder.color = redBorderColor
background = greyBackground
// Optional: Set padding inside the toolbar
insets = new Insets3f(10, 10, 10, 10)
}
selector("slider", "pp") {
insets = new Insets3f(5, 10, 5, 10) // Abstand
background = new QuadBackgroundComponent(sliderBgColor)
background = gradient.clone()
background.setColor(bgColor)
}
def pressedCommand = new Command<Button>() {
@@ -80,6 +100,30 @@ def enabledCommand = new Command<Button>() {
}
}
def repeatCommand = new Command<Button>() {
private long startTime
private long lastClick
void execute(Button source) {
// Only do the repeating click while the mouse is
// over the button (and pressed of course)
if (source.isPressed() && source.isHighlightOn()) {
long elapsedTime = System.currentTimeMillis() - startTime
// After half a second pause, click 8 times a second
if (elapsedTime > 500 && elapsedTime > lastClick + 125) {
source.click()
// Try to quantize the last click time to prevent drift
lastClick = ((elapsedTime - 500) / 125) * 125 + 500
}
}
else {
startTime = System.currentTimeMillis()
lastClick = 0
}
}
}
def stdButtonCommands = [
(ButtonAction.Down) : [pressedCommand],
(ButtonAction.Up) : [pressedCommand],
@@ -162,6 +206,7 @@ selector("slider.down.button", "pp") {
selector("checkbox", "pp") {
color = buttonEnabledColor
fontSize = 20
}
selector("rollup", "pp") {
@@ -185,3 +230,7 @@ selector("tab.button", "pp") {
buttonCommands = stdButtonCommands
}
selector("settings-title", "pp") {
fontSize = 48 // Set font size
background = new QuadBackgroundComponent(color(0.4157f, 0.4235f, 0.4392f, 1.0f)) // Grey background
}

View File

@@ -7,6 +7,7 @@ description = 'Monopoly Client'
dependencies {
implementation project(":jme-common")
implementation project(":monopoly:model")
implementation project(":monopoly:server")
implementation libs.jme3.desktop

View File

@@ -1,8 +1,11 @@
package pp.monopoly.client;
////////////////////////////////////////
// Programming project code
// UniBw M, 2022, 2023, 2024
// www.unibw.de/inf2
// (c) Mark Minas (mark.minas@unibw.de)
////////////////////////////////////////
import java.lang.System.Logger;
import java.lang.System.Logger.Level;
import java.util.prefs.Preferences;
package pp.monopoly.client;
import java.lang.System.Logger;
import java.lang.System.Logger.Level;
@@ -11,16 +14,17 @@ import java.util.prefs.Preferences;
import com.jme3.app.Application;
import com.jme3.app.state.AbstractAppState;
import com.jme3.app.state.AppStateManager;
import com.jme3.asset.AssetLoadException;
import com.jme3.asset.AssetNotFoundException;
import com.jme3.audio.AudioData;
import com.jme3.audio.AudioNode;
import pp.monopoly.notification.GameEventListener;
import pp.monopoly.notification.SoundEvent;
import static pp.util.PreferencesUtils.getPreferences;
/**
* An application state that plays sounds based on game events.
* An application state that plays sounds.
*/
public class GameSound extends AbstractAppState implements GameEventListener {
private static final Logger LOGGER = System.getLogger(GameSound.class.getName());
@@ -49,6 +53,7 @@ public class GameSound extends AbstractAppState implements GameEventListener {
/**
* Sets the enabled state of this AppState.
* Overrides {@link com.jme3.app.state.AbstractAppState#setEnabled(boolean)}
*
* @param enabled {@code true} to enable the AppState, {@code false} to disable it.
*/
@@ -56,35 +61,37 @@ public class GameSound extends AbstractAppState implements GameEventListener {
public void setEnabled(boolean enabled) {
if (isEnabled() == enabled) return;
super.setEnabled(enabled);
LOGGER.log(Level.INFO, "Sound enabled: {0}", enabled);
LOGGER.log(Level.INFO, "Sound enabled: {0}", enabled); //NON-NLS
PREFERENCES.putBoolean(ENABLED_PREF, enabled);
}
/**
* Initializes the sound effects for the game and stores the application reference.
* Initializes the sound effects for the game.
* Overrides {@link AbstractAppState#initialize(AppStateManager, Application)}
*
* @param stateManager The state manager
* @param app The application instance
* @param app The application
*/
@Override
public void initialize(AppStateManager stateManager, Application app) {
super.initialize(stateManager, app);
this.app = app; // Speichert die Application-Instanz
}
/**
* Loads a sound from the specified file.
*
* @param app The application
* @param name The name of the sound file.
* @return The loaded AudioNode.
*/
private AudioNode loadSound(String name) {
private AudioNode loadSound(Application app, String name) {
try {
AudioNode sound = new AudioNode(app.getAssetManager(), name, AudioData.DataType.Buffer);
final AudioNode sound = new AudioNode(app.getAssetManager(), name, AudioData.DataType.Buffer);
sound.setLooping(false);
sound.setPositional(false);
return sound;
} catch (Exception ex) {
}
catch (AssetLoadException | AssetNotFoundException ex) {
LOGGER.log(Level.ERROR, ex.getMessage(), ex);
}
return null;
@@ -119,4 +126,4 @@ public class GameSound extends AbstractAppState implements GameEventListener {
switch (event.sound()) {
}
}
}//heloo
}

View File

@@ -3,9 +3,6 @@ package pp.monopoly.client;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import com.jme3.app.SimpleApplication;
import com.jme3.font.BitmapFont;
import com.jme3.font.BitmapText;
@@ -13,8 +10,8 @@ import com.jme3.input.KeyInput;
import com.jme3.input.controls.ActionListener;
import com.jme3.input.controls.KeyTrigger;
import com.jme3.system.AppSettings;
import com.jme3.texture.Texture;
import com.simsilica.lemur.GuiGlobals;
import com.simsilica.lemur.Label;
import com.simsilica.lemur.style.BaseStyles;
import pp.dialog.DialogBuilder;
@@ -24,12 +21,10 @@ import pp.monopoly.client.gui.SettingsMenu;
import pp.monopoly.client.gui.TestWorld;
import pp.monopoly.game.client.ClientGameLogic;
import pp.monopoly.game.client.MonopolyClient;
import pp.monopoly.game.client.MonopolyClient;
import pp.monopoly.game.client.ServerConnection;
import pp.monopoly.notification.GameEventListener;
import pp.monopoly.notification.InfoTextEvent;
public class MonopolyApp extends SimpleApplication implements MonopolyClient, GameEventListener {
private BitmapText topText;
private final ServerConnection serverConnection;
@@ -57,13 +52,10 @@ public class MonopolyApp extends SimpleApplication implements MonopolyClient, Ga
new MonopolyApp().start();
}
public MonopolyApp() {
this.draw = new Draw(assetManager);
public MonopolyApp() {
this.draw = new Draw(assetManager);
config = new MonopolyAppConfig();
serverConnection = new NetworkSupport(this);
serverConnection = new NetworkSupport(this);
logic = new ClientGameLogic(serverConnection);
logic.addListener(this);
setShowSettings(config.getShowSettings());
@@ -106,7 +98,6 @@ public class MonopolyApp extends SimpleApplication implements MonopolyClient, Ga
BitmapFont normalFont = assetManager.loadFont("Interface/Fonts/Default.fnt");
topText = new BitmapText(normalFont);
topText.setLocalTranslation(10, settings.getHeight() - 10, 0);
topText.setLocalTranslation(10, settings.getHeight() - 10, 0);
guiNode.attachChild(topText);
}
@@ -115,9 +106,6 @@ public class MonopolyApp extends SimpleApplication implements MonopolyClient, Ga
inputManager.setCursorVisible(true);
inputManager.addMapping("ESC", new KeyTrigger(KeyInput.KEY_ESCAPE));
inputManager.addListener(escapeListener, "ESC");
inputManager.setCursorVisible(true);
inputManager.addMapping("ESC", new KeyTrigger(KeyInput.KEY_ESCAPE));
inputManager.addListener(escapeListener, "ESC");
}
private void handleEscape(boolean isPressed) {
@@ -164,14 +152,12 @@ public class MonopolyApp extends SimpleApplication implements MonopolyClient, Ga
@Override
public void receivedEvent(InfoTextEvent event) {
setInfoText(event.key());
setInfoText(event.key());
}
@Override
public void stop(boolean waitFor) {
if (executor != null) executor.shutdownNow();
serverConnection.disconnect();
serverConnection.disconnect();
super.stop(waitFor);
}
@@ -221,35 +207,4 @@ public class MonopolyApp extends SimpleApplication implements MonopolyClient, Ga
guiNode.detachAllChildren(); // Entferne die GUI
StartMenu.createStartMenu(this); // Zeige das Startmenü erneut
}
//altes Fenster beim Start von TestWorld schließen
public void startTestWorld() {
// Entferne die aktuelle GUI
guiNode.detachAllChildren();
// Erstelle ein Quadrat mit Textur
Box box = new Box(1, 0.01f, 1); // Dünnes Quadrat
Geometry geom = new Geometry("Box", box);
// Setze das Material mit Textur
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
Texture texture = assetManager.loadTexture("Pictures/board.png");
mat.setTexture("ColorMap", texture);
geom.setMaterial(mat);
// Füge das Quadrat zur Szene hinzu
rootNode.attachChild(geom);
// Setze die Kameraposition
cam.setLocation(new Vector3f(0, 0, 3));
cam.lookAt(geom.getLocalTranslation(), Vector3f.UNIT_Y);
}
public void returnToMenu() {
// Entferne die Testszene
rootNode.detachAllChildren();
// Zeige das Startmenü erneut
StartMenu.createStartMenu(this);
}
}
}

View File

@@ -2,44 +2,31 @@ package pp.monopoly.client;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import com.jme3.scene.Geometry;
import com.jme3.scene.shape.Quad;
import com.jme3.texture.Texture;
import com.simsilica.lemur.Axis;
import com.simsilica.lemur.Axis;
import com.simsilica.lemur.Button;
import com.simsilica.lemur.Container;
import com.simsilica.lemur.HAlignment;
import com.simsilica.lemur.Container;
import com.simsilica.lemur.HAlignment;
import com.simsilica.lemur.component.QuadBackgroundComponent;
import com.simsilica.lemur.component.SpringGridLayout;
import com.simsilica.lemur.component.SpringGridLayout;
import pp.dialog.Dialog;
import pp.monopoly.client.gui.CreateGameMenu;
import pp.monopoly.client.gui.SettingsMenu;
/**
* Constructs the startup menu dialog for the Monopoly application.
import pp.monopoly.client.gui.CreateGameMenu;
import pp.monopoly.client.gui.SettingsMenu;
/**
* Constructs the startup menu dialog for the Monopoly application.
import pp.monopoly.client.gui.GameMenu;
*/
*/
public class StartMenu extends Dialog {
private final MonopolyApp app;
private Container logoContainer;
private Container unibwLogoContainer;
/**
* Constructs the Startup Menu dialog for the Monopoly application.
* Constructs the Startup Menu dialog for the Monopoly application.
*
* @param app the MonopolyApp instance
@@ -49,20 +36,6 @@ public class StartMenu extends Dialog {
this.app = app;
}
/**
* Creates and displays the Start Menu with buttons for starting the game,
* opening settings, and quitting the application.
*/
public static void createStartMenu(MonopolyApp app) {
int screenWidth = app.getContext().getSettings().getWidth();
int screenHeight = app.getContext().getSettings().getHeight();
// Set up the background image
Texture backgroundImage = app.getAssetManager().loadTexture("Pictures/unibw-Bib2.png");
Quad quad = new Quad(screenWidth, screenHeight);
Geometry background = new Geometry("Background", quad);
}
/**
* Creates and displays the Start Menu with buttons for starting the game,
* opening settings, and quitting the application.
@@ -77,10 +50,8 @@ public class StartMenu extends Dialog {
Geometry background = new Geometry("Background", quad);
Material backgroundMaterial = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
backgroundMaterial.setTexture("ColorMap", backgroundImage);
backgroundMaterial.setTexture("ColorMap", backgroundImage);
background.setMaterial(backgroundMaterial);
background.setLocalTranslation(0, 0, -1); // Ensure it is behind other GUI elements
background.setLocalTranslation(0, 0, -1); // Ensure it is behind other GUI elements
app.getGuiNode().attachChild(background);
createMonopolyLogo(app);
@@ -202,11 +173,6 @@ public class StartMenu extends Dialog {
new SettingsMenu(app);
}
/**
* Quits the game application.
*/
private static void quitGame() {
System.exit(0);
/**
* Quits the game application.
*/

View File

@@ -3,10 +3,8 @@ package pp.monopoly.client.gui;
import com.jme3.scene.Node;
import com.jme3.scene.Spatial;
import pp.monopoly.model.Board;
import pp.monopoly.model.Item;
import pp.monopoly.model.Item;
import pp.monopoly.model.Visitor;
import pp.monopoly.notification.GameEventListener;
import pp.monopoly.notification.ItemAddedEvent;
@@ -26,14 +24,10 @@ abstract class BoardSynchronizer extends ModelViewSynchronizer<Item> implements
*
* @param board the game board to synchronize
* @param root the root node to which the view representations of the board items are attached
* @param board the game board to synchronize
* @param root the root node to which the view representations of the board items are attached
*/
protected BoardSynchronizer(Board board, Node root) {
protected BoardSynchronizer(Board board, Node root) {
super(root);
this.board = board;
this.board = board;
}
/**
@@ -48,7 +42,6 @@ abstract class BoardSynchronizer extends ModelViewSynchronizer<Item> implements
}
/**
* Adds the existing items from the board to the view during initialization.
* Adds the existing items from the board to the view during initialization.
*/
protected void addExisting() {
@@ -56,36 +49,26 @@ abstract class BoardSynchronizer extends ModelViewSynchronizer<Item> implements
}
/**
* Handles the event when an item is removed from the board.
* Handles the event when an item is removed from the board.
*
* @param event the event indicating that an item has been removed from the board
* @param event the event indicating that an item has been removed from the board
*/
@Override
public void receivedEvent(ItemRemovedEvent event) {
if (board == event.getBoard()) {
delete(event.getItem());
}
if (board == event.getBoard()) {
delete(event.getItem());
}
}
/**
* Handles the event when an item is added to the board.
* Handles the event when an item is added to the board.
*
* @param event the event indicating that an item has been added to the board
* @param event the event indicating that an item has been added to the board
*/
@Override
public void receivedEvent(ItemAddedEvent event) {
if (board == event.getBoard()) {
add(event.getItem());
}
if (board == event.getBoard()) {
add(event.getItem());
}
}
}

View File

@@ -5,8 +5,6 @@ import com.jme3.scene.Spatial;
import pp.monopoly.model.Figure;
/**
* Synchronizes the visual representation of the board with the game model.
* Handles updates for items on the board.
* Synchronizes the visual representation of the board with the game model.
* Handles updates for items on the board.
*/
@@ -19,7 +17,6 @@ class MapViewSynchronizer extends BoardSynchronizer {
* @param view the MapView to synchronize with the game model
*/
public MapViewSynchronizer(MapView view) {
super(view.getBoard(), view.getNode());
super(view.getBoard(), view.getNode());
this.view = view;
addExisting();

View File

@@ -1,80 +0,0 @@
package pp.monopoly.client.gui;
import com.jme3.app.SimpleApplication;
import com.jme3.material.Material;
import com.jme3.math.Vector3f;
import com.jme3.scene.Geometry;
import com.jme3.scene.shape.Box;
import com.jme3.texture.Texture;
import com.jme3.system.JmeCanvasContext;
import com.jme3.system.AppSettings;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
public class TestWorldWithMenu extends SimpleApplication {
public static void createAndShowGUI() {
// Create JFrame
JFrame frame = new JFrame("Test World with Menu");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setLayout(new BorderLayout());
frame.setSize(800, 600);
// Create Menu Bar
JMenuBar menuBar = new JMenuBar();
JMenu fileMenu = new JMenu("File");
JMenuItem exitItem = new JMenuItem(new AbstractAction("Exit") {
@Override
public void actionPerformed(ActionEvent e) {
System.exit(0);
}
});
fileMenu.add(exitItem);
menuBar.add(fileMenu);
frame.setJMenuBar(menuBar);
// Create Canvas for jMonkey
AppSettings settings = new AppSettings(true);
settings.setWidth(800);
settings.setHeight(600);
TestWorldWithMenu app = new TestWorldWithMenu();
app.setSettings(settings);
app.createCanvas(); // Create a canvas for embedding
JmeCanvasContext ctx = (JmeCanvasContext) app.getContext();
ctx.setSystemListener(app);
Canvas canvas = ctx.getCanvas();
canvas.setSize(800, 600);
// Add the canvas to JFrame
frame.add(canvas, BorderLayout.CENTER);
// Show the frame
frame.setVisible(true);
// Start the jMonkeyEngine application
app.startCanvas();
}
@Override
public void simpleInitApp() {
// Erstelle ein Quadrat
Box box = new Box(1, 0.01f, 1); // Dünnes Quadrat für die Textur
Geometry geom = new Geometry("Box", box);
// Setze das Material mit Textur
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
Texture texture = assetManager.loadTexture("Pictures/board.png"); // Replace with the path to your image
mat.setTexture("ColorMap", texture);
geom.setMaterial(mat);
// Füge das Quadrat zur Szene hinzu
rootNode.attachChild(geom);
// Setze die Kameraposition, um das Quadrat zu fokussieren
cam.setLocation(new Vector3f(0, 0, 3)); // Kamera auf der Z-Achse, nah am Quadrat
cam.lookAt(geom.getLocalTranslation(), Vector3f.UNIT_Y);
}
}

View File

@@ -7,4 +7,9 @@ description = 'Monopoly common model'
dependencies {
api project(":common")
api libs.jme3.networking
}
testImplementation libs.mockito.core
testImplementation project(":monopoly:client")
testImplementation project(":monopoly:model")
testImplementation project(":monopoly:server")
}

View File

@@ -7,13 +7,10 @@
package pp.monopoly;
import pp.util.config.Config;
import java.util.Map;
import java.util.TreeMap;
import static java.lang.Math.max;
import pp.util.config.Config;
/**
* Provides access to the configuration settings for the Monopoly game.
* <p>
@@ -31,7 +28,7 @@ public class MonopolyConfig extends Config {
* The default port number for the Monopoly server.
*/
@Property("port")
private int port = 1234;
private int port = 42069;
/**
* The width of the game map in terms of grid units.

View File

@@ -307,7 +307,7 @@ public class Player implements FieldVisitor<Void>{
return count;
}
/**
/**
* Inner class for dice functionality in the game.
* Rolls random dice values.
*/
@@ -438,7 +438,7 @@ public class Player implements FieldVisitor<Void>{
getOutOfJailCard--;
state = new ActiveState();
}
}
private class BankruptState implements PlayerState {
@@ -460,7 +460,7 @@ public class Player implements FieldVisitor<Void>{
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'useJailCard'");
}
}
private class WaitForTurnState implements PlayerState {
@@ -482,6 +482,6 @@ public class Player implements FieldVisitor<Void>{
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'useJailCard'");
}
}
}

View File

@@ -13,7 +13,7 @@ public class Card {
visitor.visit(this);
}
String getDescription() {
public String getDescription() {
return description;
}

View File

@@ -1,25 +1,26 @@
////////////////////////////////////////
// Programming project code
// UniBw M, 2022, 2023, 2024
// www.unibw.de/inf2
// (c) Mark Minas (mark.minas@unibw.de)
////////////////////////////////////////
package pp.monopoly.notification;
/**
* Event when a sound needs to be played.
* Event when an item is added to a map.
*
* @param soundFileName the sound file to be played
* @param sound the sound to be played
*/
public class SoundEvent implements GameEvent {
private final String soundFileName;
public SoundEvent(Sound sound) {
this.soundFileName = sound.getFileName(); // Angenommen, Sound hat eine Methode getFileName()
}
public String getSoundFileName() {
return soundFileName;
}
public record SoundEvent(Sound sound) implements GameEvent {
/**
* Notifies the game event listener of this event.
*
* @param listener the game event listener
*/
@Override
public void notifyListener(GameEventListener listener) {
listener.receivedEvent(this);
}
}

View File

@@ -1,385 +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());
}
}

View File

@@ -1,30 +1,106 @@
package pp.monopoly.client;
import com.jme3.input.KeyInput;
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 {
private MonopolyApp app;
private Node guiNodeMock;
@Before
public void setUp() {
app = new MonopolyApp();
// 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).handleEscape(true);
// Rufe die ESC-Tastenmethode auf
app.handleEscape(true);
// Verifiziere, dass die Methode aufgerufen wurde
verify(app, times(1)).handleEscape(true);
}
}
/*
@Test
// T002: UC-game-02 - Überprüft, ob das Startmenü nach dem Start der Anwendung angezeigt wird
@@ -33,6 +109,7 @@ public class ClientLogicTest {
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() {
@@ -158,4 +235,5 @@ public void testMainMenuButtons() {
throw new AssertionError("'ReturnButton' ist kein Button-Objekt.");
}
}
}
}
*/

View File

@@ -1,606 +1,123 @@
package pp.monopoly.game.client;
import com.jme3.scene.Spatial;
import com.simsilica.lemur.Button;
import com.simsilica.lemur.TextField;
/*
import org.junit.Before;
import org.junit.Test;
import pp.monopoly.client.MonopolyApp;
import pp.monopoly.game.server.Player;
import pp.monopoly.message.server.DiceResult;
import pp.monopoly.notification.ClientStateEvent;
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.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.*;
/**
* Tests the client-side logic of the Monopoly game.
*/
/*
public class ClientGameLogicTest {
private MonopolyApp app;
private ClientGameLogic logic;
private MonopolyApp app;
private NewGameMenu newGameMenu;
@Mock
private MonopolyServer serverMock;
@Mock
private ClientSender clientSenderMock;
@Before
public void setUp() {
app = new MonopolyApp();
app.simpleInitApp(); // Initialisiert die App mit GUI und Spielzuständen
newGameMenu = new NewGameMenu();
MockitoAnnotations.openMocks(this);
logic = new ClientGameLogic(clientSenderMock);
}
@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 sichtbar sein, nachdem ESC gedrückt wurde", gameMenu);
}
@Test
// T007: UC-game-07 - Testet, ob der Spieler erfolgreich den Namen des Hosts eingeben kann
public void testEnterHostName() {
Spatial hostNameField = app.getGuiNode().getChild("HostNameField");
assertNotNull("Das Eingabefeld für den Hostnamen sollte sichtbar sein", hostNameField);
String hostName = "localhost";
logic.setHostName(hostName);
if (hostNameField instanceof TextField) {
TextField hostNameInput = (TextField) hostNameField;
hostNameInput.setText("TestHost");
assertEquals("Der eingegebene Hostname sollte 'TestHost' sein", "TestHost", hostNameInput.getText());
}
else {
throw new AssertionError("'HostNameField' ist kein TextField-Objekt.");
}
assertEquals("The hostname should be correctly set.", hostName, logic.getHostName());
}
@Test
// T008: UC-game-08 - Testet, ob der Spieler die Portnummer des Hosts eingeben kann
public void testEnterPortNumber() {
Spatial portNumberField = app.getGuiNode().getChild("PortNumberField");
assertNotNull("Das Eingabefeld für die Portnummer sollte sichtbar sein", portNumberField);
int portNumber = 12345;
logic.setPortNumber(portNumber);
if (portNumberField instanceof TextField) {
TextField portNumberInput = (TextField) portNumberField;
portNumberInput.setText("12345");
assertEquals("Die eingegebene Portnummer sollte '12345' sein", "12345", portNumberInput.getText());
}
else {
throw new AssertionError("'PortNumberField' ist kein TextField-Objekt.");
}
assertEquals("The port number should be correctly set.", portNumber, logic.getPortNumber());
}
@Test
// T009: UC-game-09 - Testet, ob der Spieler das Erstellen eines Spiels abbrechen kann
public void testCancelGameCreation() {
Spatial cancelButtonSpatial = app.getGuiNode().getChild("CancelButton");
assertNotNull("Der 'Abbrechen'-Button sollte existieren", cancelButtonSpatial);
doNothing().when(clientSenderMock).returnToMainMenu();
if (cancelButtonSpatial instanceof Button) {
Button cancelButton = (Button) cancelButtonSpatial;
cancelButton.click();
logic.cancelGameCreation();
Spatial mainMenu = app.getGuiNode().getChild("MainMenu");
assertNotNull("Das Hauptmenü sollte nach dem Abbrechen des Spiels sichtbar sein", mainMenu);
}
else {
throw new AssertionError("'CancelButton' ist kein Button-Objekt.");
}
verify(clientSenderMock, times(1)).returnToMainMenu();
}
@Test
public void testEnterPlayerLobby() {
doNothing().when(clientSenderMock).enterLobby();
logic.enterLobby();
verify(clientSenderMock, times(1)).enterLobby();
}
/*
@Test
// T010: UC-game-10 - Testet, ob der Spieler die Spielerlobby betreten kann
public void testEnterPlayerLobby() {
app.receivedEvent(new pp.monopoly.notification.ClientStateEvent(pp.monopoly.notification.ClientStateEvent.State.LOBBY));
Spatial playerLobby = app.getGuiNode().getChild("PlayerLobby");
assertNotNull("Die Spielerlobby sollte nach dem Beitritt sichtbar sein", playerLobby);
}
@Test
// T010: UC-game-10 - Testet, ob der Spieler die Spielerlobby betreten kann
public void testEnterPlayerLobby() {
// Simuliert den Empfang eines ClientStateEvent für den Lobby-State
app.receivedEvent(new ClientStateEvent(ClientStateEvent.State.LOBBY));
// Überprüft, ob das Lobby-UI sichtbar ist
Spatial playerLobby = app.getGuiNode().getChild("PlayerLobby");
assertNotNull("Die Spielerlobby sollte nach dem Beitritt sichtbar sein", playerLobby);
*/
@Test
// T011: UC-game-11 - Testet, ob der hostende Spieler einen Startbetrag eingeben kann
public void testEnterStartingCapital() {
Spatial startingCapitalField = app.getGuiNode().getChild("StartingCapitalField");
assertNotNull("Das Eingabefeld für den Startbetrag sollte existieren", startingCapitalField);
int startingCapital = 1500;
logic.setStartingCapital(startingCapital);
if (startingCapitalField instanceof TextField) {
TextField startingCapitalInput = (TextField) startingCapitalField;
startingCapitalInput.setText("1500");
assertEquals("Der eingegebene Startbetrag sollte '1500' sein", "1500", startingCapitalInput.getText());
}
else {
throw new AssertionError("'StartingCapitalField' ist kein TextField-Objekt.");
}
assertEquals("The starting capital should be correctly set.", startingCapital, logic.getStartingCapital());
}
@Test
// T012: UC-game-12 - Testet, ob der Spieler den Startbetrag um 100 € erhöhen kann
public void testIncreaseStartingCapital() {
Spatial increaseButton = app.getGuiNode().getChild("IncreaseCapitalButton");
assertNotNull("Der 'Erhöhen'-Button sollte existieren", increaseButton);
logic.setStartingCapital(1500);
logic.increaseStartingCapital();
if (increaseButton instanceof Button) {
Button increaseCapitalButton = (Button) increaseButton;
increaseCapitalButton.click();
Spatial startingCapitalField = app.getGuiNode().getChild("StartingCapitalField");
if (startingCapitalField instanceof TextField) {
TextField startingCapitalInput = (TextField) startingCapitalField;
assertEquals("Der Startbetrag sollte um 100 erhöht worden sein", "1600", startingCapitalInput.getText());
}
else {
throw new AssertionError("'StartingCapitalField' ist kein TextField-Objekt.");
}
}
else {
throw new AssertionError("'IncreaseCapitalButton' ist kein Button-Objekt.");
}
assertEquals("The starting capital should increase by 100.", 1600, logic.getStartingCapital());
}
@Test
// T013: UC-game-13 - Testet, ob der Spieler den Startbetrag um 100 € senken kann
public void testDecreaseStartingCapital() {
Spatial decreaseButton = app.getGuiNode().getChild("DecreaseCapitalButton");
assertNotNull("Der 'Senken'-Button sollte existieren", decreaseButton);
logic.setStartingCapital(1500);
logic.decreaseStartingCapital();
if (decreaseButton instanceof Button) {
Button decreaseCapitalButton = (Button) decreaseButton;
decreaseCapitalButton.click();
Spatial startingCapitalField = app.getGuiNode().getChild("StartingCapitalField");
if (startingCapitalField instanceof TextField) {
TextField startingCapitalInput = (TextField) startingCapitalField;
assertEquals("Der Startbetrag sollte um 100 gesenkt worden sein", "1400", startingCapitalInput.getText());
}
else {
throw new AssertionError("'StartingCapitalField' ist kein TextField-Objekt.");
}
}
else {
throw new AssertionError("'DecreaseCapitalButton' ist kein Button-Objekt.");
}
assertEquals("The starting capital should decrease by 100.", 1400, logic.getStartingCapital());
}
@Test
// T014: UC-game-14 - Testet, ob die Standard-Spielernamen korrekt voreingestellt sind
public void testDefaultPlayerName() {
Spatial playerNameField = app.getGuiNode().getChild("PlayerNameField");
assertNotNull("Das Eingabefeld für den Spielernamen sollte existieren", playerNameField);
logic.addPlayer("Player 1");
if (playerNameField instanceof TextField) {
TextField playerNameInput = (TextField) playerNameField;
assertEquals("Der voreingestellte Spielername sollte 'Spieler 1' sein", "Spieler 1", playerNameInput.getText());
}
else {
throw new AssertionError("'PlayerNameField' ist kein TextField-Objekt.");
}
assertTrue("The player name should be correctly set.", logic.getPlayerNames().contains("Player 1"));
}
@Test
// T015: UC-game-15 - Testet, ob der Spieler einen Anzeigenamen eingeben kann
public void testEnterDisplayName() {
Spatial displayNameField = app.getGuiNode().getChild("DisplayNameField");
assertNotNull("Das Eingabefeld für den Anzeigenamen sollte existieren", displayNameField);
String displayName = "JohnDoe";
logic.setPlayerName(displayName);
if (displayNameField instanceof TextField) {
TextField displayNameInput = (TextField) displayNameField;
displayNameInput.setText("MaxMustermann");
assertEquals("Der eingegebene Anzeigename sollte 'MaxMustermann' sein", "MaxMustermann", displayNameInput.getText());
}
else {
throw new AssertionError("'DisplayNameField' ist kein TextField-Objekt.");
}
assertEquals("The display name should be correctly set.", displayName, logic.getPlayerName());
}
@Test
// T016: UC-game-16 - Testet, ob eine Warnung angezeigt wird, wenn ein Spieler einen bereits belegten Namen eingibt
public void testDuplicateNameEntry() {
Spatial playerNameField = app.getGuiNode().getChild("PlayerNameField");
assertNotNull("Das Eingabefeld für den Spielernamen sollte existieren", playerNameField);
logic.addPlayer("Player 1");
boolean result = logic.addPlayer("Player 1");
if (playerNameField instanceof TextField) {
TextField playerNameInput = (TextField) playerNameField;
playerNameInput.setText("Spieler 1");
app.getGuiNode().getChild("AddPlayerButton").click(); // Spieler hinzufügen
playerNameInput.setText("Spieler 1");
app.getGuiNode().getChild("AddPlayerButton").click(); // Spieler mit gleichem Namen hinzufügen
Spatial warning = app.getGuiNode().getChild("DuplicateNameWarning");
assertNotNull("Es sollte eine Warnung angezeigt werden, wenn ein Name doppelt vergeben wird", warning);
}
else {
throw new AssertionError("'PlayerNameField' ist kein TextField-Objekt.");
}
assertTrue("Duplicate names should not be allowed.", !result);
}
@Test
// T017: UC-game-17 - Testet, ob der Spieler eine verfügbare Spielfigurfarbe auswählen kann
public void testSelectPlayerColor() {
Spatial colorSelector = app.getGuiNode().getChild("ColorSelector");
assertNotNull("Der Farbwähler sollte existieren", colorSelector);
logic.addPlayer("Player 1");
boolean result = logic.setPlayerColor("Player 1", "Red");
if (colorSelector instanceof Button) {
Button colorButton = (Button) colorSelector;
colorButton.click();
Spatial selectedColor = app.getGuiNode().getChild("SelectedColor");
assertNotNull("Die gewählte Farbe sollte sichtbar sein", selectedColor);
}
else {
throw new AssertionError("'ColorSelector' ist kein Button-Objekt.");
}
}
@Test
// T018: UC-game-18 - Testet, ob eine belegte Spielfigurfarbe nicht ausgewählt werden kann
public void testSelectOccupiedColor() {
app.getGuiNode().getChild("ColorSelectorRed").click(); // Spieler 1 wählt Rot
app.getGuiNode().getChild("AddPlayerButton").click(); // Spieler 1 hinzufügen
app.getGuiNode().getChild("ColorSelectorRed").click(); // Spieler 2 versucht Rot zu wählen
Spatial warning = app.getGuiNode().getChild("ColorOccupiedWarning");
assertNotNull("Es sollte eine Warnung angezeigt werden, wenn eine belegte Farbe ausgewählt wird", warning);
}
@Test
// T019: UC-game-19 - Testet, ob der Spieler eine Spielfigur auswählen kann
public void testSelectPlayerToken() {
Spatial tokenSelector = app.getGuiNode().getChild("TokenSelector");
assertNotNull("Der Token-Wähler sollte existieren", tokenSelector);
if (tokenSelector instanceof Button) {
Button tokenButton = (Button) tokenSelector;
tokenButton.click();
Spatial selectedToken = app.getGuiNode().getChild("SelectedToken");
assertNotNull("Die gewählte Spielfigur sollte sichtbar sein", selectedToken);
}
else {
throw new AssertionError("'TokenSelector' ist kein Button-Objekt.");
}
}
@Test
// T020: UC-game-20 - Testet, ob eine belegte Spielfigur nicht ausgewählt werden kann
public void testSelectOccupiedToken() {
app.getGuiNode().getChild("TokenSelectorShip").click();
app.getGuiNode().getChild("AddPlayerButton").click();
app.getGuiNode().getChild("TokenSelectorShip").click();
Spatial warning = app.getGuiNode().getChild("TokenOccupiedWarning");
assertNotNull("Es sollte eine Warnung angezeigt werden, wenn eine belegte Spielfigur ausgewählt wird", warning);
}
@Test
// T021: UC-game-14 - Überprüft, ob der Spieler zur „Spiel erstellen“-Ansicht zurückkehrt, wenn Abbrechen gedrückt wird
public void testCancelPlayerLobby() {
Spatial cancelButtonSpatial = app.getGuiNode().getChild("CancelLobbyButton");
assertNotNull("Der 'Abbrechen'-Button in der Lobby sollte existieren", cancelButtonSpatial);
if (cancelButtonSpatial instanceof Button) {
Button cancelButton = (Button) cancelButtonSpatial;
cancelButton.click();
Spatial mainMenu = app.getGuiNode().getChild("MainMenu");
assertNotNull("Das Hauptmenü sollte nach dem Abbrechen der Lobby sichtbar sein", mainMenu);
}
else {
throw new AssertionError("'CancelLobbyButton' ist kein Button-Objekt.");
}
}
@Test
// T022: UC-game-15 - Überprüft, ob das Spielmenü in der Lobby durch Drücken der ESC-Taste geöffnet wird
public void testOpenLobbyMenuWithESC() {
app.escape(true); // Simuliert das Drücken der ESC-Taste
Spatial lobbyMenu = app.getGuiNode().getChild("LobbyMenu");
assertNotNull("Das Lobby-Menü sollte sichtbar sein, nachdem ESC in der Lobby gedrückt wurde", lobbyMenu);
}
@Test
// T023: UC-game-16 - Testet, ob der Spieler die Auswahl der Spielfigur bestätigen kann
public void testPlayerReadyConfirmation() {
Spatial confirmButtonSpatial = app.getGuiNode().getChild("ConfirmTokenButton");
assertNotNull("Der 'Bestätigen'-Button für die Spielfigur sollte existieren", confirmButtonSpatial);
if (confirmButtonSpatial instanceof Button) {
Button confirmButton = (Button) confirmButtonSpatial;
confirmButton.click();
Spatial readyStatus = app.getGuiNode().getChild("PlayerReadyStatus");
assertNotNull("Der Status 'Bereit' sollte angezeigt werden, nachdem die Spielfigur bestätigt wurde", readyStatus);
}
else {
throw new AssertionError("'ConfirmTokenButton' ist kein Button-Objekt.");
}
}
@Test
// T024: UC-game-16 - Überprüft, ob das Spiel startet, wenn alle Spieler ihre Auswahl bestätigt haben
public void testAllPlayersReady() {
app.receivedEvent(new pp.monopoly.notification.ClientStateEvent(pp.monopoly.notification.ClientStateEvent.State.ALL_PLAYERS_READY));
Spatial gameScreen = app.getGuiNode().getChild("GameScreen");
assertNotNull("Das Spiel sollte starten, wenn alle Spieler bereit sind", gameScreen);
}
@Test
// T025: UC-game-17 - Testet, ob das Einstellungen-Menü während des Spiels geöffnet wird
public void testOpenMainGameSettings () {
app.escape(true);
Spatial settingsButton = app.getGuiNode().getChild("SettingsButton");
assertNotNull("Der 'Einstellungen'-Button sollte im Spielmenü vorhanden sein", settingsButton);
if (settingsButton instanceof Button) {
((Button) settingsButton).click();
Spatial settingsMenu = app.getGuiNode().getChild("SettingsMenu");
assertNotNull("Das Einstellungen-Menü sollte im Spiel angezeigt werden", settingsMenu);
}
else {
throw new AssertionError("'SettingsButton' ist kein Button-Objekt.");
}
}
@Test
// T026: UC-gameplay-01 - Überprüft, ob der Spieler erfolgreich würfeln kann
public void testRollDice() {
Spatial rollDiceButton = app.getGuiNode().getChild("RollDiceButton");
assertNotNull("Der 'Würfeln'-Button sollte sichtbar sein", rollDiceButton);
if (rollDiceButton instanceof Button) {
((Button) rollDiceButton).click(); // Simuliert einen Würfelwurf
Spatial diceResult = app.getGuiNode().getChild("DiceResult");
assertNotNull("Das Ergebnis des Würfelwurfs sollte angezeigt werden", diceResult);
}
}
@Test
// T027: UC-gameplay-01 - Überprüft, ob der aktive Spieler die richtige Anzahl an Feldern basierend auf dem Wurf bewegt
public void testMovePlayerAutomatically() {
Game game = new Game(); // Initialisiert ein neues Spiel
PlayerHandler playerHandler = game.getPlayerHandler(); // Holt den PlayerHandler, der die Spieler verwaltet
Player activePlayer = playerHandler.getActivePlayer(); // Holt den aktuellen aktiven Spieler
assertNotNull("Es sollte einen aktiven Spieler geben", activePlayer);
DiceResult diceResult = game.rollDice(); // Würfelwurf simulieren
int steps = diceResult.getTotal();
int initialPosition = activePlayer.getFieldId(); // Ursprüngliche Position des aktiven Spielers
playerHandler.moveActivePlayer(steps); // Bewegt den aktiven Spieler basierend auf dem Wurf
int expectedPosition = (initialPosition + steps) % game.getGameBoard().getNumberOfFields(); // Zielposition berechnen
int newPosition = activePlayer.getFieldId();
assertEquals("Der aktive Spieler sollte sich korrekt bewegen", expectedPosition, newPosition);
// Überprüfen, dass alle anderen Spieler im WaitForTurn-State bleiben
playerHandler.getPlayers().stream()
.filter(player -> player != activePlayer)
.forEach(player -> assertTrue("Andere Spieler sollten im WaitForTurn-State sein", player.getState() instanceof WaitForTurnState));
}
@Test
// T028: UC-gameplay-02 - Überprüft, ob die Würfel zufällige Zahlen generieren
public void testGenerationDice() {
boolean isRandom = false;
DiceResult previousResult = null;
for (int i = 0; i < 10; i++) {
DiceResult currentResult = app.getGame().rollDice();
assertNotNull("Das Würfelergebnis sollte nicht null sein", currentResult);
assertTrue("Die Würfelzahl 1 sollte zwischen 1 und 6 liegen", currentResult.getDice1() >= 1 && currentResult.getDice1() <= 6);
assertTrue("Die Würfelzahl 2 sollte zwischen 1 und 6 liegen", currentResult.getDice2() >= 1 && currentResult.getDice2() <= 6);
if (previousResult != null && (currentResult.getDice1() != previousResult.getDice1() || currentResult.getDice2() != previousResult.getDice2())) {
isRandom = true; // Unterschiedliche Würfelwerte gefunden
break;
}
previousResult = currentResult;
}
assertTrue("Die Würfelergebnisse sollten zufällig sein", isRandom);
}
@Test
// T029: UC-gameplay-03 - Überprüft, ob die richtigen Augenzahlen angezeigt werden
public void testDisplayResults() {
DiceResult result = app.getGame().rollDice();
assertNotNull("Das Würfelergebnis sollte nicht null sein", result);
assertTrue("Die Würfelzahl 1 sollte zwischen 1 und 6 liegen", result.getDice1() >= 1 && result.getDice1() <= 6);
assertTrue("Die Würfelzahl 2 sollte zwischen 1 und 6 liegen", result.getDice2() >= 1 && result.getDice2() <= 6);
assertEquals("Die Summe sollte korrekt berechnet werden", result.getDice1() + result.getDice2(), result.getTotal());
}
@Test
// T030: UC-gameplay-04 - Überprüfen, ob die Summe der Würfelergebnisse korrekt berechnet wird
public void testSumDiceResults() {
Spatial rollDiceButton = app.getGuiNode().getChild("RollDiceButton");
assertNotNull("Der 'Würfeln'-Button sollte sichtbar sein", rollDiceButton);
if (rollDiceButton instanceof Button) {
((Button) rollDiceButton).click(); // Simuliert einen Würfelwurf
Spatial diceResult1 = app.getGuiNode().getChild("DiceResult1");
Spatial diceResult2 = app.getGuiNode().getChild("DiceResult2");
assertNotNull("Die Ergebnisse des Würfelwurfs sollten angezeigt werden", diceResult1);
assertNotNull("Die Ergebnisse des Würfelwurfs sollten angezeigt werden", diceResult2);
int result1 = Integer.parseInt(diceResult1.getUserData("value").toString());
int result2 = Integer.parseInt(diceResult2.getUserData("value").toString());
int expectedSum = result1 + result2;
Spatial sumDisplay = app.getGuiNode().getChild("DiceSum");
assertEquals("Die Summe der Würfelergebnisse sollte korrekt angezeigt werden", expectedSum, Integer.parseInt(sumDisplay.getUserData("value").toString()));
} else {
throw new AssertionError("'RollDiceButton' ist kein Button-Objekt.");
}
}
@Test
// T031: UC-gameplay-05 - Überprüfen, ob die Würfel nach dem Wurf ausgegraut werden
public void testGrayOutDiceAfterRoll() {
Spatial rollDiceButton = app.getGuiNode().getChild("RollDiceButton");
assertNotNull("Der 'Würfeln'-Button sollte sichtbar sein", rollDiceButton);
if (rollDiceButton instanceof Button) {
((Button) rollDiceButton).click(); // Simuliert einen Würfelwurf
Spatial diceDisplay = app.getGuiNode().getChild("DiceDisplay");
assertNotNull("Die Würfelanzeige sollte nach dem Wurf sichtbar sein", diceDisplay);
boolean isGrayedOut = diceDisplay.getUserData("grayedOut");
assertTrue("Die Würfel sollten nach dem Wurf ausgegraut sein", isGrayedOut);
} else {
throw new AssertionError("'RollDiceButton' ist kein Button-Objekt.");
}
}
@Test
// T032: UC-gameplay-06 - Überprüfen, ob das Würfeln eines Paschs erkannt wird
public void testDetectDouble() {
Spatial rollDiceButton = app.getGuiNode().getChild("RollDiceButton");
assertNotNull("Der 'Würfeln'-Button sollte sichtbar sein", rollDiceButton);
if (rollDiceButton instanceof Button) {
// Simuliert mehrere Würfe, um einen Pasch zu erkennen
for (int i = 0; i < 10; i++) {
((Button) rollDiceButton).click();
Spatial diceResult1 = app.getGuiNode().getChild("DiceResult1");
Spatial diceResult2 = app.getGuiNode().getChild("DiceResult2");
int result1 = Integer.parseInt(diceResult1.getUserData("value").toString());
int result2 = Integer.parseInt(diceResult2.getUserData("value").toString());
if (result1 == result2) {
Spatial doubleIndicator = app.getGuiNode().getChild("DoubleIndicator");
assertNotNull("Ein Pasch sollte angezeigt werden, wenn zwei identische Zahlen geworfen werden", doubleIndicator);
break;
}
}
} else {
throw new AssertionError("'RollDiceButton' ist kein Button-Objekt.");
}
}
@Test
// T033: UC-gameplay-06 - Überprüfen, ob der Spieler bei einem Pasch erneut würfeln darf
public void testDoubleRoll() {
Spatial rollDiceButton = app.getGuiNode().getChild("RollDiceButton");
assertNotNull("Der 'Würfeln'-Button sollte sichtbar sein", rollDiceButton);
if (rollDiceButton instanceof Button) {
// Simuliert das Würfeln eines Paschs
((Button) rollDiceButton).click();
Spatial diceResult1 = app.getGuiNode().getChild("DiceResult1");
Spatial diceResult2 = app.getGuiNode().getChild("DiceResult2");
int result1 = Integer.parseInt(diceResult1.getUserData("value").toString());
int result2 = Integer.parseInt(diceResult2.getUserData("value").toString());
if (result1 == result2) { // Überprüft, ob ein Pasch geworfen wurde
Spatial rollAgainIndicator = app.getGuiNode().getChild("RollAgainIndicator");
assertNotNull("Der Spieler sollte bei einem Pasch erneut würfeln dürfen", rollAgainIndicator);
}
} else {
throw new AssertionError("'RollDiceButton' ist kein Button-Objekt.");
}
}
@Test
// T034: UC-gameplay-06 - Überprüfen, ob der Spieler nach dem dritten Pasch ins Gefängnis muss
public void testTripleDoubleGulag() {
int doubleCount = 0;
for (int i = 0; i < 3; i++) {
Spatial rollDiceButton = app.getGuiNode().getChild("RollDiceButton");
assertNotNull("Der 'Würfeln'-Button sollte sichtbar sein", rollDiceButton);
if (rollDiceButton instanceof Button) {
((Button) rollDiceButton).click();
Spatial diceResult1 = app.getGuiNode().getChild("DiceResult1");
Spatial diceResult2 = app.getGuiNode().getChild("DiceResult2");
int result1 = Integer.parseInt(diceResult1.getUserData("value").toString());
int result2 = Integer.parseInt(diceResult2.getUserData("value").toString());
if (result1 == result2) {
doubleCount++;
}
if (doubleCount == 3) {
Spatial jailIndicator = app.getGuiNode().getChild("JailIndicator");
assertNotNull("Der Spieler sollte nach dem dritten Pasch ins Gefängnis gehen", jailIndicator);
break;
}
} else {
throw new AssertionError("'RollDiceButton' ist kein Button-Objekt.");
}
}
assertTrue("Der Spieler sollte drei Paschs geworfen haben", doubleCount == 3);
}
@Test
// T035: UC-gameplay-07 - Überprüfen, ob ein Spieler für Steuerfelder korrekt belastet wird
public void testTaxFieldCharges() {
Game game = new Game();
PlayerHandler playerHandler = game.getPlayerHandler();
Player activePlayer = playerHandler.getActivePlayer();
assertNotNull("Es sollte einen aktiven Spieler geben", activePlayer);
int initialBalance = activePlayer.getAccountBalance();
activePlayer.moveToField(game.getGameBoard().getFieldById(4)); // ID 4: Steuerfeld "Diszi"
game.getGameBoard().applyFieldEffect(activePlayer);
int expectedBalance = initialBalance - 200; // Beispielsteuer: 200 €
assertEquals("Der Spieler sollte für das Steuerfeld korrekt belastet werden", expectedBalance, activePlayer.getAccountBalance());
}
@Test
// T036: UC-gameplay-08 - Überprüfen, ob ein Spieler korrekt ins Gefängnis geschickt wird
public void testGoToJailField() {
Game game = new Game();
PlayerHandler playerHandler = game.getPlayerHandler();
Player activePlayer = playerHandler.getActivePlayer();
assertNotNull("Es sollte einen aktiven Spieler geben", activePlayer);
activePlayer.moveToField(game.getGameBoard().getFieldById(30)); // ID 30: Ab ins Gefängnis
game.getGameBoard().applyFieldEffect(activePlayer);
assertEquals("Der Spieler sollte ins Gefängnis geschickt werden", 10, activePlayer.getFieldId()); // ID 10: Gefängnis
}
@Test
// T037: UC-gameplay-09 - Überprüfen, ob ein Spieler bei "Frei Parken" keine Gebühren zahlt
public void testFreeParking() {
Game game = new Game();
PlayerHandler playerHandler = game.getPlayerHandler();
Player activePlayer = playerHandler.getActivePlayer();
assertNotNull("Es sollte einen aktiven Spieler geben", activePlayer);
int initialBalance = activePlayer.getAccountBalance();
activePlayer.moveToField(game.getGameBoard().getFieldById(20)); // ID 20: Frei Parken
game.getGameBoard().applyFieldEffect(activePlayer);
assertEquals("Der Spieler sollte bei 'Frei Parken' keine Gebühren zahlen", initialBalance, activePlayer.getAccountBalance());
assertTrue("The player should be able to select an available color.", result);
}
}
*/

View File

@@ -65,7 +65,7 @@ public class MonopolyServer implements MessageListener<HostedConnection>, Connec
/**
* Creates the server.
*/
MonopolyServer() {
public MonopolyServer() {
config.readFromIfExists(CONFIG_FILE);
LOGGER.log(Level.INFO, "Configuration: {0}", config); //NON-NLS
logic = new ServerGameLogic(this, config);