Index: trunk/src/org/openstreetmap/josm/gui/io/SaveLayersDialog.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/io/SaveLayersDialog.java	(revision 14357)
+++ trunk/src/org/openstreetmap/josm/gui/io/SaveLayersDialog.java	(revision 14358)
@@ -276,8 +276,5 @@
     private static void warn(String msg, List<SaveLayerInfo> infos, String title) {
         JPanel panel = new LayerListWarningMessagePanel(msg, infos);
-        // For unit test coverage in headless mode
-        if (!GraphicsEnvironment.isHeadless()) {
-            JOptionPane.showConfirmDialog(MainApplication.getMainFrame(), panel, title, JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE);
-        }
+        JOptionPane.showConfirmDialog(MainApplication.getMainFrame(), panel, title, JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE);
     }
 
Index: trunk/test/unit/org/openstreetmap/josm/gui/io/SaveLayersDialogTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/gui/io/SaveLayersDialogTest.java	(revision 14357)
+++ trunk/test/unit/org/openstreetmap/josm/gui/io/SaveLayersDialogTest.java	(revision 14358)
@@ -2,4 +2,5 @@
 package org.openstreetmap.josm.gui.io;
 
+import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
@@ -7,4 +8,8 @@
 import java.util.Collections;
 import java.util.List;
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+import javax.swing.JList;
+import javax.swing.JOptionPane;
 
 import org.junit.Rule;
@@ -13,4 +18,5 @@
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
 import org.openstreetmap.josm.testutils.JOSMTestRules;
+import org.openstreetmap.josm.testutils.mockers.JOptionPaneSimpleMocker;
 
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
@@ -34,4 +40,26 @@
     public void testConfirmSaveLayerInfosOK() {
         final List<SaveLayerInfo> list = Collections.singletonList(new SaveLayerInfo(new OsmDataLayer(new DataSet(), null, null)));
+
+        final JOptionPaneSimpleMocker jopsMocker = new JOptionPaneSimpleMocker() {
+            @Override
+            protected void act(final Object message) {
+                // use this opportunity to assert that our SaveLayerInfo is the single option in the JList
+                @SuppressWarnings("unchecked")
+                final JList<SaveLayerInfo> jList = (JList<SaveLayerInfo>) ((JComponent) message).getComponent(1);
+                assertEquals(1, jList.getModel().getSize());
+                assertEquals(list.get(0), jList.getModel().getElementAt(0));
+            }
+
+            @Override
+            protected String getStringFromMessage(final Object message) {
+                return ((JLabel) ((JComponent) message).getComponent(0)).getText();
+            }
+        };
+
+        jopsMocker.getMockResultMap().put(
+            "<html>1 layer has unresolved conflicts.<br>Either resolve them first or discard the "
+            + "modifications.<br>Layer with conflicts:</html>", JOptionPane.OK_OPTION
+        );
+
         assertFalse(SaveLayersDialog.confirmSaveLayerInfosOK(new SaveLayersModel() {
             @Override
@@ -40,4 +68,17 @@
             }
         }));
+
+        assertEquals(1, jopsMocker.getInvocationLog().size());
+        Object[] invocationLogEntry = jopsMocker.getInvocationLog().get(0);
+        assertEquals(JOptionPane.OK_OPTION, (int) invocationLogEntry[0]);
+        assertEquals("Unsaved data and conflicts", invocationLogEntry[2]);
+
+        jopsMocker.resetInvocationLog();
+        jopsMocker.getMockResultMap().clear();
+        jopsMocker.getMockResultMap().put(
+            "<html>1 layer needs saving but has no associated file.<br>Either select a file for this "
+            + "layer or discard the changes.<br>Layer without a file:</html>", JOptionPane.OK_OPTION
+        );
+
         assertFalse(SaveLayersDialog.confirmSaveLayerInfosOK(new SaveLayersModel() {
             @Override
@@ -46,4 +87,18 @@
             }
         }));
+
+        assertEquals(1, jopsMocker.getInvocationLog().size());
+        invocationLogEntry = jopsMocker.getInvocationLog().get(0);
+        assertEquals(JOptionPane.OK_OPTION, (int) invocationLogEntry[0]);
+        assertEquals("Unsaved data and missing associated file", invocationLogEntry[2]);
+
+        jopsMocker.resetInvocationLog();
+        jopsMocker.getMockResultMap().clear();
+        jopsMocker.getMockResultMap().put(
+            "<html>1 layer needs saving but has an associated file<br>which cannot be written.<br>Either "
+            + "select another file for this layer or discard the changes.<br>Layer with a non-writable "
+            + "file:</html>", JOptionPane.OK_OPTION
+        );
+
         assertFalse(SaveLayersDialog.confirmSaveLayerInfosOK(new SaveLayersModel() {
             @Override
@@ -52,4 +107,13 @@
             }
         }));
+
+        assertEquals(1, jopsMocker.getInvocationLog().size());
+        invocationLogEntry = jopsMocker.getInvocationLog().get(0);
+        assertEquals(JOptionPane.OK_OPTION, (int) invocationLogEntry[0]);
+        assertEquals("Unsaved data non-writable files", invocationLogEntry[2]);
+
+        jopsMocker.resetInvocationLog();
+        jopsMocker.getMockResultMap().clear();
+
         assertTrue(SaveLayersDialog.confirmSaveLayerInfosOK(new SaveLayersModel()));
     }
Index: trunk/test/unit/org/openstreetmap/josm/testutils/mockers/JOptionPaneSimpleMocker.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/testutils/mockers/JOptionPaneSimpleMocker.java	(revision 14357)
+++ trunk/test/unit/org/openstreetmap/josm/testutils/mockers/JOptionPaneSimpleMocker.java	(revision 14358)
@@ -76,4 +76,13 @@
             JOptionPane.CANCEL_OPTION,
             JOptionPane.CLOSED_OPTION
+        },
+        // it's hard to know much about DEFAULT_OPTION, so we can't really police anything here, so
+        // including all known options
+        JOptionPane.DEFAULT_OPTION, new int[] {
+            JOptionPane.OK_OPTION,
+            JOptionPane.CANCEL_OPTION,
+            JOptionPane.CLOSED_OPTION,
+            JOptionPane.YES_OPTION,
+            JOptionPane.NO_OPTION
         }
     );
