mirror of
https://github.com/2OOP/pism.git
synced 2026-02-04 02:44:50 +00:00
Added unittests for Player, changed imports for LocalTicTacToe.java
This commit is contained in:
@@ -6,8 +6,8 @@ import org.apache.logging.log4j.Logger;
|
||||
import org.toop.eventbus.Events;
|
||||
import org.toop.eventbus.GlobalEventBus;
|
||||
import org.toop.frontend.UI.UIGameBoard;
|
||||
import org.toop.game.GameBase;
|
||||
import org.toop.game.tictactoe.MinMaxTicTacToe;
|
||||
import org.toop.game.tictactoe.GameBase;
|
||||
import org.toop.game.tictactoe.ai.MinMaxTicTacToe;
|
||||
import org.toop.game.tictactoe.TicTacToe;
|
||||
|
||||
/**
|
||||
|
||||
32
src/test/java/org/toop/game/tictactoe/PlayerTest.java
Normal file
32
src/test/java/org/toop/game/tictactoe/PlayerTest.java
Normal file
@@ -0,0 +1,32 @@
|
||||
package org.toop.game.tictactoe;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
class PlayerTest {
|
||||
|
||||
private Player playerA;
|
||||
private Player playerB;
|
||||
|
||||
@BeforeEach
|
||||
void setup() {
|
||||
playerA = new Player("testA", 'X');
|
||||
playerB = new Player("testB", 'O');
|
||||
}
|
||||
|
||||
@Test
|
||||
void testNameGetter_returnsTrueForValidName() {
|
||||
assertEquals("testA", playerA.getName());
|
||||
assertEquals("testB", playerB.getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSymbolGetter_returnsTrueForValidSymbol() {
|
||||
assertEquals('X', playerA.getSymbol());
|
||||
assertEquals('O', playerB.getSymbol());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user