Index: trunk/test/unit/org/openstreetmap/josm/gui/MainApplicationTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/gui/MainApplicationTest.java	(revision 18601)
+++ trunk/test/unit/org/openstreetmap/josm/gui/MainApplicationTest.java	(revision 18602)
@@ -36,4 +36,6 @@
 import mockit.Mock;
 import mockit.MockUp;
+import org.awaitility.Awaitility;
+import org.awaitility.Durations;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.extension.RegisterExtension;
@@ -222,4 +224,8 @@
             assertDoesNotThrow(MainApplication::setupUIManager);
 
+            /* We cannot sync on the worker or EDT threads since the bug report handler makes a new thread */
+            Awaitility.await().atMost(Durations.ONE_HUNDRED_MILLISECONDS)
+                    .pollDelay(Durations.ONE_MILLISECOND)
+                    .until(() -> !BugReportQueue.getInstance().exceptionHandlingInProgress());
             assertNotNull(exceptionAtomicReference.get());
             assertTrue(exceptionAtomicReference.get() instanceof UnsupportedOperationException);
