diff --git a/.idea/dictionaries/kevint.xml b/.idea/dictionaries/kevint.xml index fbe5c1bed..b4b5a4cef 100644 --- a/.idea/dictionaries/kevint.xml +++ b/.idea/dictionaries/kevint.xml @@ -4,6 +4,7 @@ bellsoft cooldown liberica + spdx terasology diff --git a/build.gradle b/build.gradle index 63aff1e61..6d11f3fe0 100644 --- a/build.gradle +++ b/build.gradle @@ -118,7 +118,7 @@ dependencies { } testImplementation "org.mockito:mockito-junit-jupiter:3.3.+" - testImplementation('org.spf4j:spf4j-slf4j-test:8.8.+') { + testImplementation('org.spf4j:spf4j-slf4j-test:8.8.5') { because "testable logging" } testImplementation("org.slf4j:slf4j-api:1.7.+!!") { diff --git a/src/test/java/org/terasology/launcher/game/TestRunGameTask.java b/src/test/java/org/terasology/launcher/game/TestRunGameTask.java index 68f220810..b42345571 100644 --- a/src/test/java/org/terasology/launcher/game/TestRunGameTask.java +++ b/src/test/java/org/terasology/launcher/game/TestRunGameTask.java @@ -4,6 +4,7 @@ package org.terasology.launcher.game; import com.google.common.util.concurrent.ThreadFactoryBuilder; +import javafx.application.Platform; import javafx.concurrent.WorkerStateEvent; import javafx.util.Pair; import org.junit.jupiter.api.AfterEach; @@ -223,7 +224,8 @@ public void testSuccessEvent() throws Exception { Happenings.TASK_COMPLETED.val() ); - final Runnable handleLineSent = () -> actualHistory.add(Happenings.PROCESS_OUTPUT_LINE.val()); + final Runnable handleLineSent = () -> Platform.runLater( + () -> actualHistory.add(Happenings.PROCESS_OUTPUT_LINE.val())); // This makes our "process," which streams out its lines and runs the callback after each. final Process lineAtATimeProcess = new MockProcesses.OneLineAtATimeProcess( @@ -245,11 +247,10 @@ public void testSuccessEvent() throws Exception { // Act! executor.submit(gameTask); - WaitForAsyncUtils.waitForFxEvents(); - var actualReturnValue = gameTask.get(); // task.get blocks until it has run to completion // Assert! + WaitForAsyncUtils.waitForFxEvents(); assertTrue(actualReturnValue); assertIterableEquals(expectedHistory, actualHistory, renderColumns(actualHistory, expectedHistory)); @@ -271,7 +272,8 @@ public void testFastExitDoesNotResultInSuccess() { Happenings.TASK_FAILED.val() ); - final Runnable handleLineSent = () -> actualHistory.add(Happenings.PROCESS_OUTPUT_LINE.val()); + final Runnable handleLineSent = () -> Platform.runLater( + () -> actualHistory.add(Happenings.PROCESS_OUTPUT_LINE.val())); // This makes our "process," which streams out its lines and runs the callback after each. final Process lineAtATimeProcess = new MockProcesses.OneLineAtATimeProcess( @@ -297,9 +299,9 @@ public void testFastExitDoesNotResultInSuccess() { // Act! executor.submit(gameTask); - WaitForAsyncUtils.waitForFxEvents(); - var thrown = assertThrows(ExecutionException.class, gameTask::get); + + WaitForAsyncUtils.waitForFxEvents(); assertThat(thrown.getCause(), instanceOf(RunGameTask.GameExitTooSoon.class)); assertIterableEquals(expectedHistory, actualHistory, renderColumns(actualHistory, expectedHistory));