create PlayerTest
This commit is contained in:
parent
135ec7e8d5
commit
2ef4c3f584
|
@ -103,11 +103,9 @@ public class LanguageConfigurator {
|
|||
englishDictionary.put("participantNotExist","Participant does not exist");
|
||||
germanDictionary.put("placeNotExist","Teilnehmer existiert nicht");
|
||||
englishDictionary.put("placeNotExist","Participant does not exist");
|
||||
|
||||
//SaveMsg
|
||||
germanDictionary.put("save","Zuletzt gespeichert: ");
|
||||
englishDictionary.put("save","Last saved: ");
|
||||
|
||||
//Alert
|
||||
germanDictionary.put("yes","Ja");
|
||||
englishDictionary.put("yes","Yes");
|
||||
|
@ -119,7 +117,6 @@ public class LanguageConfigurator {
|
|||
englishDictionary.put("headerDelete","Delete Tournament?");
|
||||
germanDictionary.put("contentDelete","Sind Sie sicher, dass sie das Turnier entfernen wollen?\nNach diesem Vorgang kann es nicht wiederhergestellt werden.");
|
||||
englishDictionary.put("contentDelete","Are you shure you want to delete the tournament?\nAfter that there is no way to restore.");
|
||||
|
||||
germanDictionary.put("titleSchedule","Neu erstellen");
|
||||
englishDictionary.put("titleSchedule","Create new");
|
||||
germanDictionary.put("headerSchedule","Spielplan neu erstellen?");
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
import ch.zhaw.projekt2.turnierverwaltung.InvalidNameException;
|
||||
import ch.zhaw.projekt2.turnierverwaltung.Person;
|
||||
import ch.zhaw.projekt2.turnierverwaltung.Player;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
public class PlayerTest {
|
||||
private Player player;
|
||||
|
||||
@Test
|
||||
@DisplayName("Test invalid Parameter")
|
||||
void invalidParams() {
|
||||
try {
|
||||
assertThrows(Person.InvalidPhoneNumberException.class,()->new Player("A","a",".sad",""));
|
||||
assertThrows(Player.InvalidDateException.class,()->new Player("A","a","","a"));
|
||||
player = new Player("A","A","","");
|
||||
assertEquals("A",player.getFirstName());
|
||||
assertEquals("A",player.getName());
|
||||
assertEquals("",player.getPhoneNumber());
|
||||
assertNull(player.getDateOfBirth());
|
||||
} catch (InvalidNameException | Person.InvalidPhoneNumberException | Player.InvalidDateException e) {
|
||||
fail();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Test equals")
|
||||
void equalsTest() {
|
||||
try {
|
||||
player = new Player("A","A","","");
|
||||
assertTrue(player.equals(player));
|
||||
assertFalse(player.equals(new Player("B", "D", "", "")));
|
||||
assertTrue(player.equals(new Player("A", "A", "", "")));
|
||||
} catch (InvalidNameException | Person.InvalidPhoneNumberException | Player.InvalidDateException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package ch.zhaw.projekt2.turnierverwaltung;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class LanguageTest {
|
||||
|
||||
@Test
|
||||
@DisplayName("Test Dictionary")
|
||||
void test() {
|
||||
LanguageConfigurator languageConfigurator = new LanguageConfigurator();
|
||||
Assertions.assertEquals("Ja",languageConfigurator.getSelectedLanguage("yes"));
|
||||
languageConfigurator.changeLanguage(LanguageConfigurator.Language.ENGLISH);
|
||||
Assertions.assertEquals("Yes",languageConfigurator.getSelectedLanguage("yes"));
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue