create PlaceTest

This commit is contained in:
Andrin Fassbind 2022-05-13 22:06:58 +02:00
parent fd06e24e21
commit 2e314497db
2 changed files with 36 additions and 1 deletions

View File

@ -2,7 +2,6 @@ package ch.zhaw.projekt2.turnierverwaltung;
import javafx.scene.control.Labeled;
import javafx.scene.control.MenuItem;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

View File

@ -0,0 +1,36 @@
package ch.zhaw.projekt2.turnierverwaltung;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
public class PlaceTest {
private Place place;
@Test
@DisplayName("Test Params")
void paramTest() {
Assertions.assertThrows(InvalidNameException.class, () -> new Place("*"));
try {
place = new Place("placeA");
assertEquals("placeA", place.getName());
} catch (InvalidNameException e) {
fail();
}
}
@Test
@DisplayName("Place Equals Test")
void testEqual() {
try {
place = new Place("placeA");
assertTrue(place.equals(place));
assertTrue(place.equals(new Place("placeA")));
assertFalse(place.equals(new Place("nads")));
} catch (InvalidNameException e) {
fail();
}
}
}