2021-10-08 09:51:14 +02:00
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
|
2021-10-09 12:31:56 +02:00
|
|
|
/**
|
|
|
|
* Klasse GameTest
|
|
|
|
*
|
|
|
|
* Diese Klasse beinhaltet und führt alle Testfälle für die Klasse GameTest aus
|
|
|
|
*
|
|
|
|
*/
|
2021-10-08 09:15:24 +02:00
|
|
|
class GameTest {
|
|
|
|
|
2021-10-15 00:21:52 +02:00
|
|
|
@Test
|
|
|
|
public void placeOneField() {
|
|
|
|
Game game = new Game();
|
|
|
|
|
|
|
|
game.placeField(1);
|
|
|
|
}
|
2021-10-09 12:31:56 +02:00
|
|
|
|
2021-10-15 00:21:52 +02:00
|
|
|
@Test
|
|
|
|
public void testGameShouldbeTie() {
|
|
|
|
Game game = new Game();
|
2021-10-09 12:31:56 +02:00
|
|
|
|
2021-10-15 00:21:52 +02:00
|
|
|
game.placeField(1);
|
|
|
|
game.placeField(2);
|
|
|
|
game.placeField(3);
|
|
|
|
game.placeField(5);
|
|
|
|
game.placeField(4);
|
|
|
|
game.placeField(6);
|
|
|
|
game.placeField(8);
|
|
|
|
game.placeField(7);
|
|
|
|
game.placeField(9);
|
2021-10-08 09:51:14 +02:00
|
|
|
}
|
|
|
|
|
2021-10-15 00:21:52 +02:00
|
|
|
@Test
|
|
|
|
public void Player1WinVariant147() {
|
|
|
|
Game game = new Game();
|
|
|
|
|
|
|
|
game.placeField(1);
|
|
|
|
game.placeField(2);
|
|
|
|
game.placeField(4);
|
|
|
|
game.placeField(3);
|
|
|
|
game.placeField(7);
|
2021-10-08 09:51:14 +02:00
|
|
|
}
|
2021-10-08 09:15:24 +02:00
|
|
|
|
2021-10-15 00:21:52 +02:00
|
|
|
@Test
|
|
|
|
public void Player2WinVariant147() {
|
|
|
|
Game game = new Game();
|
|
|
|
|
|
|
|
game.placeField(2);
|
|
|
|
game.placeField(1);
|
|
|
|
game.placeField(3);
|
|
|
|
game.placeField(4);
|
|
|
|
game.placeField(6);
|
|
|
|
game.placeField(7);
|
|
|
|
}
|
2021-10-09 12:31:56 +02:00
|
|
|
|
|
|
|
|
2021-10-08 09:51:14 +02:00
|
|
|
@Test
|
2021-10-15 00:21:52 +02:00
|
|
|
public void Player1WinVariant123() {
|
|
|
|
Game game = new Game();
|
|
|
|
|
2021-10-09 12:31:56 +02:00
|
|
|
game.placeField(1);
|
2021-10-15 00:21:52 +02:00
|
|
|
game.placeField(4);
|
|
|
|
game.placeField(2);
|
|
|
|
game.placeField(5);
|
|
|
|
game.placeField(3);
|
|
|
|
}
|
2021-10-09 12:31:56 +02:00
|
|
|
|
2021-10-15 00:21:52 +02:00
|
|
|
@Test
|
|
|
|
public void Player2WinVariant123() {
|
|
|
|
Game game = new Game();
|
|
|
|
|
|
|
|
game.placeField(4);
|
|
|
|
game.placeField(1);
|
|
|
|
game.placeField(5);
|
|
|
|
game.placeField(2);
|
|
|
|
game.placeField(7);
|
|
|
|
game.placeField(3);
|
2021-10-08 09:15:24 +02:00
|
|
|
}
|
2021-10-09 12:31:56 +02:00
|
|
|
|
2021-10-15 00:21:52 +02:00
|
|
|
@Test
|
|
|
|
public void Player1WinVariant159() {
|
|
|
|
Game game = new Game();
|
|
|
|
|
|
|
|
game.placeField(1);
|
|
|
|
game.placeField(3);
|
|
|
|
game.placeField(5);
|
|
|
|
game.placeField(2);
|
|
|
|
game.placeField(9);
|
|
|
|
}
|
2021-10-09 12:31:56 +02:00
|
|
|
|
|
|
|
@Test
|
2021-10-15 00:21:52 +02:00
|
|
|
public void Player2WinVariant159() {
|
|
|
|
Game game = new Game();
|
|
|
|
|
|
|
|
game.placeField(3);
|
2021-10-09 12:31:56 +02:00
|
|
|
game.placeField(1);
|
2021-10-15 00:21:52 +02:00
|
|
|
game.placeField(2);
|
|
|
|
game.placeField(5);
|
|
|
|
game.placeField(6);
|
|
|
|
game.placeField(9);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
public void Player1WinVariant258() {
|
|
|
|
Game game = new Game();
|
|
|
|
|
2021-10-09 12:31:56 +02:00
|
|
|
game.placeField(2);
|
|
|
|
game.placeField(3);
|
|
|
|
game.placeField(5);
|
|
|
|
game.placeField(4);
|
2021-10-15 00:21:52 +02:00
|
|
|
game.placeField(8);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
public void Player2WinVariant258() {
|
|
|
|
Game game = new Game();
|
|
|
|
|
|
|
|
game.placeField(1);
|
|
|
|
game.placeField(2);
|
|
|
|
game.placeField(4);
|
|
|
|
game.placeField(5);
|
|
|
|
game.placeField(3);
|
|
|
|
game.placeField(8);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
public void Player1WinVariant369() {
|
|
|
|
Game game = new Game();
|
|
|
|
|
|
|
|
game.placeField(3);
|
|
|
|
game.placeField(1);
|
|
|
|
game.placeField(6);
|
|
|
|
game.placeField(2);
|
|
|
|
game.placeField(9);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
public void Player2WinVariant369() {
|
|
|
|
Game game = new Game();
|
|
|
|
|
|
|
|
game.placeField(1);
|
|
|
|
game.placeField(3);
|
|
|
|
game.placeField(2);
|
|
|
|
game.placeField(6);
|
|
|
|
game.placeField(4);
|
|
|
|
game.placeField(9);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
public void Player1WinVariant456() {
|
|
|
|
Game game = new Game();
|
|
|
|
|
|
|
|
game.placeField(4);
|
|
|
|
game.placeField(1);
|
|
|
|
game.placeField(5);
|
|
|
|
game.placeField(2);
|
|
|
|
game.placeField(6);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
public void Player2WinVariant456() {
|
|
|
|
Game game = new Game();
|
|
|
|
|
|
|
|
game.placeField(7);
|
|
|
|
game.placeField(4);
|
|
|
|
game.placeField(1);
|
|
|
|
game.placeField(5);
|
|
|
|
game.placeField(2);
|
2021-10-09 12:31:56 +02:00
|
|
|
game.placeField(6);
|
2021-10-15 00:21:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
public void Player1WinVariant789() {
|
|
|
|
Game game = new Game();
|
|
|
|
|
|
|
|
game.placeField(7);
|
|
|
|
game.placeField(2);
|
2021-10-09 12:31:56 +02:00
|
|
|
game.placeField(8);
|
2021-10-15 00:21:52 +02:00
|
|
|
game.placeField(1);
|
|
|
|
game.placeField(9);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
public void Player2WinVariant789() {
|
|
|
|
Game game = new Game();
|
|
|
|
|
|
|
|
game.placeField(1);
|
2021-10-09 12:31:56 +02:00
|
|
|
game.placeField(7);
|
2021-10-15 00:21:52 +02:00
|
|
|
game.placeField(2);
|
|
|
|
game.placeField(8);
|
|
|
|
game.placeField(4);
|
2021-10-09 12:31:56 +02:00
|
|
|
game.placeField(9);
|
|
|
|
}
|
|
|
|
|
2021-10-15 00:21:52 +02:00
|
|
|
@Test
|
|
|
|
public void Player1WinVariant357() {
|
|
|
|
Game game = new Game();
|
2021-10-09 12:31:56 +02:00
|
|
|
|
2021-10-15 00:21:52 +02:00
|
|
|
game.placeField(3);
|
|
|
|
game.placeField(2);
|
|
|
|
game.placeField(5);
|
|
|
|
game.placeField(4);
|
|
|
|
game.placeField(7);
|
|
|
|
}
|
2021-10-09 12:31:56 +02:00
|
|
|
|
|
|
|
@Test
|
2021-10-15 00:21:52 +02:00
|
|
|
public void Player2WinVariant357() {
|
|
|
|
Game game = new Game();
|
2021-10-09 12:31:56 +02:00
|
|
|
|
2021-10-15 00:21:52 +02:00
|
|
|
game.placeField(1);
|
|
|
|
game.placeField(3);
|
|
|
|
game.placeField(2);
|
|
|
|
game.placeField(5);
|
|
|
|
game.placeField(4);
|
|
|
|
game.placeField(7);
|
2021-10-09 12:31:56 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2021-10-15 08:24:21 +02:00
|
|
|
@Test
|
|
|
|
public void changeLanguage() {
|
|
|
|
Game game = new Game();
|
|
|
|
|
|
|
|
game.placeField(1);
|
|
|
|
game.changeLanguage("en");
|
|
|
|
game.placeField(3);
|
|
|
|
game.placeField(2);
|
|
|
|
game.changeLanguage("vn");
|
|
|
|
game.placeField(5);
|
|
|
|
game.placeField(4);
|
|
|
|
game.changeLanguage("de");
|
|
|
|
game.placeField(7);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2021-10-08 09:15:24 +02:00
|
|
|
}
|