diff --git a/gruppe06-hufflepuff-projekt1-tic-tac-toe.iml b/gruppe06-hufflepuff-projekt1-tic-tac-toe.iml index 6c1a90a..c5e5271 100644 --- a/gruppe06-hufflepuff-projekt1-tic-tac-toe.iml +++ b/gruppe06-hufflepuff-projekt1-tic-tac-toe.iml @@ -34,5 +34,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Game.java b/src/Game.java index ba94343..ac5b621 100644 --- a/src/Game.java +++ b/src/Game.java @@ -20,6 +20,7 @@ public class Game { public Game() { gamefield = new Gamefield(); language = new Language("de"); + } /** diff --git a/src/Language.java b/src/Language.java index fd3270a..ce825a4 100644 --- a/src/Language.java +++ b/src/Language.java @@ -54,8 +54,16 @@ public class Language { * Diese Methode gibt den Gewinnertext über eine Konsolenausgabe aus. * @param player beinhaltet den Integer, welcher den Spieler representiert. */ - public void outputWinnerText(int player){ - System.out.println(checkLanguage("Spieler "+player+" hat gewonnen! Gut gespiel","Player "+player+" won! Well played genius!","Người chơi "+player+" đã thắng. Làm tốt!")); + public void outputWinnerText(int player) { + System.out.println(checkLanguage("Spieler "+player+" hat gewonnen! Gut gespiel!","Player "+player+" won! Well played genius!","Người chơi "+player+" đã thắng. Làm tốt!")); + } + + /** + * Methode: outputGameOverText + * Diese Methode gibt den Text aus, falls es keinen Gewinner gibt und informiert den Nutzer über das Ende des Spiels. + */ + public void outputGameOverText(){ + System.out.println(checkLanguage("Das Spiel ist zu ende! Es ist untentschieden","The Game has finished! We have no winner","Trò chơi kết thúc rồi! Chúng tôi không có người chiến thắng")); } /** diff --git a/test/LanguageTest.java b/test/LanguageTest.java new file mode 100644 index 0000000..e030838 --- /dev/null +++ b/test/LanguageTest.java @@ -0,0 +1,46 @@ +import org.junit.Before; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.*; + +class LanguageTest { + + private Language deutsch = new Language("de"); + private Language english = new Language("en"); + private Language viet = new Language("vn"); + private Language def = new Language("dasd"); + + @Test + void setOutputLanguage() { + deutsch.setOutputLanguage("en"); + } + + @Test + void outputWinnerText() { + deutsch.outputWinnerText(1); + english.outputWinnerText(2); + viet.outputWinnerText(3); + } + + @Test + void outputGameOverText(){ + deutsch.outputGameOverText(); + english.outputGameOverText(); + viet.outputGameOverText(); + } + + @Test + void outputNextPlayerText() { + deutsch.outputNextPlayerText(1); + english.outputNextPlayerText(2); + viet.outputNextPlayerText(3); + } + + @Test + void outputWrongFieldSelected() { + deutsch.outputWrongFieldSelected(); + english.outputWrongFieldSelected(); + viet.outputWrongFieldSelected(); + } +} \ No newline at end of file