create PlaceTest
This commit is contained in:
parent
fd06e24e21
commit
2e314497db
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue