Index: trunk/test/unit/org/openstreetmap/josm/actions/ExitActionTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/actions/ExitActionTest.java	(revision 17276)
+++ trunk/test/unit/org/openstreetmap/josm/actions/ExitActionTest.java	(revision 17277)
@@ -3,4 +3,6 @@
 
 import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import java.awt.GraphicsEnvironment;
 
 import org.junit.jupiter.api.Test;
@@ -86,10 +88,12 @@
             }
         };
-        new MockUp<SaveLayersDialog>() {
-            @Mock
-            private void closeDialog(Invocation invocation) {
-                saveLayersDialogCloseDialogCalled[0] = true;
-            }
-        };
+        if (!GraphicsEnvironment.isHeadless()) {
+            new MockUp<SaveLayersDialog>() {
+                @Mock
+                private void closeDialog(Invocation invocation) {
+                    saveLayersDialogCloseDialogCalled[0] = true;
+                }
+            };
+        }
 
         // No layer
@@ -105,5 +109,7 @@
             assertTrue(imageProviderShutdownCalledNowTrue[0]);
             assertTrue(jcsCacheManagerShutdownCalled[0]);
-            assertTrue(saveLayersDialogCloseDialogCalled[0]);
+            if (!GraphicsEnvironment.isHeadless()) {
+                assertTrue(saveLayersDialogCloseDialogCalled[0]);
+            }
         }
     }
Index: trunk/test/unit/org/openstreetmap/josm/data/osm/search/SearchCompilerTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/data/osm/search/SearchCompilerTest.java	(revision 17276)
+++ trunk/test/unit/org/openstreetmap/josm/data/osm/search/SearchCompilerTest.java	(revision 17277)
@@ -604,5 +604,5 @@
         TaggingPresets.readFromPreferences();
 
-        assertThrows(IllegalArgumentException.class, () -> SearchCompiler.compile(settings));
+        assertThrows(SearchParseError.class, () -> SearchCompiler.compile(settings));
     }
 
