From fd06e24e2126dded5fc53099f71f2b2cd642b7b5 Mon Sep 17 00:00:00 2001 From: Andrin Fassbind Date: Fri, 13 May 2022 21:54:21 +0200 Subject: [PATCH] create PersonTest --- .../turnierverwaltung/PersonTest.java | 25 +++++++++++++++++++ .../turnierverwaltung}/PlayerTest.java | 5 ++-- 2 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 app/src/test/java/ch/zhaw/projekt2/turnierverwaltung/PersonTest.java rename app/src/test/java/{ => ch/zhaw/projekt2/turnierverwaltung}/PlayerTest.java (89%) diff --git a/app/src/test/java/ch/zhaw/projekt2/turnierverwaltung/PersonTest.java b/app/src/test/java/ch/zhaw/projekt2/turnierverwaltung/PersonTest.java new file mode 100644 index 0000000..4a462db --- /dev/null +++ b/app/src/test/java/ch/zhaw/projekt2/turnierverwaltung/PersonTest.java @@ -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(); + } + } + +} diff --git a/app/src/test/java/PlayerTest.java b/app/src/test/java/ch/zhaw/projekt2/turnierverwaltung/PlayerTest.java similarity index 89% rename from app/src/test/java/PlayerTest.java rename to app/src/test/java/ch/zhaw/projekt2/turnierverwaltung/PlayerTest.java index 3003af4..9b22d6d 100644 --- a/app/src/test/java/PlayerTest.java +++ b/app/src/test/java/ch/zhaw/projekt2/turnierverwaltung/PlayerTest.java @@ -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;