create PersonTest

This commit is contained in:
Andrin Fassbind 2022-05-13 21:54:21 +02:00
parent 2ef4c3f584
commit fd06e24e21
2 changed files with 27 additions and 3 deletions

View File

@ -0,0 +1,25 @@
package ch.zhaw.projekt2.turnierverwaltung;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
public class PersonTest {
private Person person;
@Test
@DisplayName("Test invalid Parameter")
void invalidParams() {
try {
assertThrows(Person.InvalidPhoneNumberException.class,()->new Person("A","a",".sad"));
person = new Person("A","A","");
assertEquals("A", person.getFirstName());
assertEquals("A", person.getName());
assertEquals("", person.getPhoneNumber());
} catch (InvalidNameException | Person.InvalidPhoneNumberException e) {
fail();
}
}
}

View File

@ -1,6 +1,5 @@
import ch.zhaw.projekt2.turnierverwaltung.InvalidNameException;
import ch.zhaw.projekt2.turnierverwaltung.Person;
import ch.zhaw.projekt2.turnierverwaltung.Player;
package ch.zhaw.projekt2.turnierverwaltung;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;