Setup Platform for runLater in GardenSchedule

Otherwise Test planTaskForCrop crashes due to unitialized Platform
This commit is contained in:
Elias Csomor 2022-12-09 17:35:41 +01:00
parent 5830ee5180
commit 56020a7529
1 changed files with 13 additions and 0 deletions

View File

@ -3,6 +3,9 @@ package ch.zhaw.gartenverwaltung.models;
import ch.zhaw.gartenverwaltung.io.*; import ch.zhaw.gartenverwaltung.io.*;
import ch.zhaw.gartenverwaltung.models.GardenSchedule; import ch.zhaw.gartenverwaltung.models.GardenSchedule;
import ch.zhaw.gartenverwaltung.types.*; import ch.zhaw.gartenverwaltung.types.*;
import javafx.application.Platform;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
@ -29,6 +32,16 @@ class GardenScheduleTest {
List<TaskTemplate> exampleTaskTemplateList; List<TaskTemplate> exampleTaskTemplateList;
GardenSchedule model; GardenSchedule model;
@BeforeAll
static void setUpAll() {
Platform.startup(()->{});
}
@AfterAll
static void tearDownAll() {
Platform.exit();
}
@BeforeEach @BeforeEach
void setUp() throws IOException, HardinessZoneNotSetException { void setUp() throws IOException, HardinessZoneNotSetException {
createExampleTaskList(); createExampleTaskList();