From cb29be62043064f1fa172202152e7a8e13a7b4e4 Mon Sep 17 00:00:00 2001 From: schrom01 Date: Fri, 15 Oct 2021 08:24:21 +0200 Subject: [PATCH] corrections in output texts added separator after language change --- .idea/runConfigurations.xml | 10 ++++++++++ src/Game.java | 1 + src/Language.java | 10 +++++----- test/GameTest.java | 16 ++++++++++++++++ 4 files changed, 32 insertions(+), 5 deletions(-) create mode 100644 .idea/runConfigurations.xml diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml new file mode 100644 index 0000000..797acea --- /dev/null +++ b/.idea/runConfigurations.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/src/Game.java b/src/Game.java index 060fa42..3139ab4 100644 --- a/src/Game.java +++ b/src/Game.java @@ -79,6 +79,7 @@ public class Game { * @param language Spielsprache welche zur Verfügung stehen "de","en","vn" */ public void changeLanguage(String language) { + this.gamefield.outputSeparator(); this.language.setOutputLanguage(language); } diff --git a/src/Language.java b/src/Language.java index 2a10b9b..98b6fa3 100644 --- a/src/Language.java +++ b/src/Language.java @@ -52,9 +52,9 @@ public class Language { return true; } System.out.println(checkLanguage( - "Diese Sprache ist nicht zulässig", - "This Language is not valid", - "Ngôn ngữ này không được phép")); + "Diese Sprache ist nicht zulässig.", + "This language is not valid.", + "Ngôn ngữ này không được phép.")); return false; } @@ -78,8 +78,8 @@ public class Language { public void outputMoveText(int move, int player) { System.out.println(checkLanguage( "Spiezug: " + move + ", Spieler " + player + " spielt.", - "Move: " + move + ", Player " + player + "plays", - "Di chuyển: " + move + ", Người " + player + " chơi" + "Move: " + move + ", Player " + player + " plays.", + "Di chuyển: " + move + ", Người " + player + " chơi." )); } diff --git a/test/GameTest.java b/test/GameTest.java index 3209b45..d270114 100644 --- a/test/GameTest.java +++ b/test/GameTest.java @@ -216,4 +216,20 @@ class GameTest { } + @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); + + } + } \ No newline at end of file