-Class LanguageTest implemented
This commit is contained in:
parent
2715530b3a
commit
0fb86c03e5
|
@ -34,5 +34,31 @@
|
||||||
<SOURCES />
|
<SOURCES />
|
||||||
</library>
|
</library>
|
||||||
</orderEntry>
|
</orderEntry>
|
||||||
|
<orderEntry type="module-library" scope="TEST">
|
||||||
|
<library name="JUnit4">
|
||||||
|
<CLASSES>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/junit/junit/4.13.1/junit-4.13.1.jar!/" />
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar!/" />
|
||||||
|
</CLASSES>
|
||||||
|
<JAVADOC />
|
||||||
|
<SOURCES />
|
||||||
|
</library>
|
||||||
|
</orderEntry>
|
||||||
|
<orderEntry type="module-library" scope="TEST">
|
||||||
|
<library name="JUnit5.7.0">
|
||||||
|
<CLASSES>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter/5.7.0/junit-jupiter-5.7.0.jar!/" />
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-api/5.7.0/junit-jupiter-api-5.7.0.jar!/" />
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/org/apiguardian/apiguardian-api/1.1.0/apiguardian-api-1.1.0.jar!/" />
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/org/opentest4j/opentest4j/1.2.0/opentest4j-1.2.0.jar!/" />
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-commons/1.7.0/junit-platform-commons-1.7.0.jar!/" />
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-params/5.7.0/junit-jupiter-params-5.7.0.jar!/" />
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-engine/5.7.0/junit-jupiter-engine-5.7.0.jar!/" />
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-engine/1.7.0/junit-platform-engine-1.7.0.jar!/" />
|
||||||
|
</CLASSES>
|
||||||
|
<JAVADOC />
|
||||||
|
<SOURCES />
|
||||||
|
</library>
|
||||||
|
</orderEntry>
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
|
@ -20,6 +20,7 @@ public class Game {
|
||||||
public Game() {
|
public Game() {
|
||||||
gamefield = new Gamefield();
|
gamefield = new Gamefield();
|
||||||
language = new Language("de");
|
language = new Language("de");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -54,8 +54,16 @@ public class Language {
|
||||||
* Diese Methode gibt den Gewinnertext über eine Konsolenausgabe aus.
|
* Diese Methode gibt den Gewinnertext über eine Konsolenausgabe aus.
|
||||||
* @param player beinhaltet den Integer, welcher den Spieler representiert.
|
* @param player beinhaltet den Integer, welcher den Spieler representiert.
|
||||||
*/
|
*/
|
||||||
public void outputWinnerText(int player){
|
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!"));
|
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"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -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();
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue