Index: /trunk/src/org/openstreetmap/josm/gui/history/HistoryBrowserModel.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/history/HistoryBrowserModel.java	(revision 10108)
+++ /trunk/src/org/openstreetmap/josm/gui/history/HistoryBrowserModel.java	(revision 10109)
@@ -242,5 +242,5 @@
 
     /**
-     * replies the tag table model for the respective point in time
+     * Replies the tag table model for the respective point in time.
      *
      * @param pointInTimeType the type of the point in time (must not be null)
@@ -252,31 +252,36 @@
         if (pointInTimeType.equals(PointInTimeType.CURRENT_POINT_IN_TIME))
             return currentTagTableModel;
-        else if (pointInTimeType.equals(PointInTimeType.REFERENCE_POINT_IN_TIME))
+        else // REFERENCE_POINT_IN_TIME
             return referenceTagTableModel;
-
-        // should not happen
-        return null;
-    }
-
+    }
+
+    /**
+     * Replies the node list table model for the respective point in time.
+     *
+     * @param pointInTimeType the type of the point in time (must not be null)
+     * @return the node list table model
+     * @throws IllegalArgumentException if pointInTimeType is null
+     */
     public DiffTableModel getNodeListTableModel(PointInTimeType pointInTimeType) {
         CheckParameterUtil.ensureParameterNotNull(pointInTimeType, "pointInTimeType");
         if (pointInTimeType.equals(PointInTimeType.CURRENT_POINT_IN_TIME))
             return currentNodeListTableModel;
-        else if (pointInTimeType.equals(PointInTimeType.REFERENCE_POINT_IN_TIME))
+        else // REFERENCE_POINT_IN_TIME
             return referenceNodeListTableModel;
-
-        // should not happen
-        return null;
-    }
-
+    }
+
+    /**
+     * Replies the relation member table model for the respective point in time.
+     *
+     * @param pointInTimeType the type of the point in time (must not be null)
+     * @return the relation member table model
+     * @throws IllegalArgumentException if pointInTimeType is null
+     */
     public DiffTableModel getRelationMemberTableModel(PointInTimeType pointInTimeType) {
         CheckParameterUtil.ensureParameterNotNull(pointInTimeType, "pointInTimeType");
         if (pointInTimeType.equals(PointInTimeType.CURRENT_POINT_IN_TIME))
             return currentRelationMemberTableModel;
-        else if (pointInTimeType.equals(PointInTimeType.REFERENCE_POINT_IN_TIME))
+        else // REFERENCE_POINT_IN_TIME
             return referenceRelationMemberTableModel;
-
-        // should not happen
-        return null;
     }
 
Index: /trunk/src/org/openstreetmap/josm/gui/preferences/advanced/PreferencesTable.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/preferences/advanced/PreferencesTable.java	(revision 10108)
+++ /trunk/src/org/openstreetmap/josm/gui/preferences/advanced/PreferencesTable.java	(revision 10109)
@@ -8,4 +8,5 @@
 import java.awt.Component;
 import java.awt.Font;
+import java.awt.GraphicsEnvironment;
 import java.awt.GridBagLayout;
 import java.awt.event.MouseAdapter;
@@ -95,10 +96,12 @@
     public boolean editPreference(final JComponent gui) {
         if (getSelectedRowCount() != 1) {
-            JOptionPane.showMessageDialog(
-                    gui,
-                    tr("Please select the row to edit."),
-                    tr("Warning"),
-                    JOptionPane.WARNING_MESSAGE
-                    );
+            if (!GraphicsEnvironment.isHeadless()) {
+                JOptionPane.showMessageDialog(
+                        gui,
+                        tr("Please select the row to edit."),
+                        tr("Warning"),
+                        JOptionPane.WARNING_MESSAGE
+                        );
+            }
             return false;
         }
@@ -122,5 +125,5 @@
     }
 
-    static boolean doEditList(final JComponent gui, final PrefEntry e, ListSetting lSetting) {
+    private static boolean doEditList(final JComponent gui, final PrefEntry e, ListSetting lSetting) {
         ListEditor lEditor = new ListEditor(gui, e, lSetting);
         lEditor.showDialog();
@@ -135,5 +138,5 @@
     }
 
-    static boolean doEditListList(final JComponent gui, final PrefEntry e, ListListSetting llSetting) {
+    private static boolean doEditListList(final JComponent gui, final PrefEntry e, ListListSetting llSetting) {
         ListListEditor llEditor = new ListListEditor(gui, e, llSetting);
         llEditor.showDialog();
@@ -148,5 +151,5 @@
     }
 
-    static boolean doEditMapList(final JComponent gui, final PrefEntry e, MapListSetting mlSetting) {
+    private static boolean doEditMapList(final JComponent gui, final PrefEntry e, MapListSetting mlSetting) {
         MapListEditor mlEditor = new MapListEditor(gui, e, mlSetting);
         mlEditor.showDialog();
@@ -192,12 +195,7 @@
         rbString.setSelected(true);
 
-        ExtendedDialog dlg = new ExtendedDialog(gui, tr("Add setting"), new String[] {tr("OK"), tr("Cancel")});
-        dlg.setButtonIcons(new String[] {"ok.png", "cancel.png"});
-        dlg.setContent(p);
-        dlg.showDialog();
-
         PrefEntry pe = null;
         boolean ok = false;
-        if (dlg.getValue() == 1) {
+        if (!GraphicsEnvironment.isHeadless() && askAddSetting(gui, p)) {
             if (rbString.isSelected()) {
                 StringSetting sSetting = new StringSetting(null);
@@ -221,5 +219,10 @@
     }
 
-    static boolean doAddSimple(final JComponent gui, PrefEntry pe, StringSetting sSetting) {
+    private static boolean askAddSetting(JComponent gui, JPanel p) {
+        return new ExtendedDialog(gui, tr("Add setting"), new String[] {tr("OK"), tr("Cancel")})
+                .setContent(p).setButtonIcons(new String[] {"ok.png", "cancel.png"}).showDialog().getValue() == 1;
+    }
+
+    private static boolean doAddSimple(final JComponent gui, PrefEntry pe, StringSetting sSetting) {
         StringEditor sEditor = new StringEditor(gui, pe, sSetting);
         sEditor.showDialog();
@@ -234,5 +237,5 @@
     }
 
-    static boolean doAddList(final JComponent gui, PrefEntry pe, ListSetting lSetting) {
+    private static boolean doAddList(final JComponent gui, PrefEntry pe, ListSetting lSetting) {
         ListEditor lEditor = new ListEditor(gui, pe, lSetting);
         lEditor.showDialog();
@@ -247,5 +250,5 @@
     }
 
-    static boolean doAddListList(final JComponent gui, PrefEntry pe, ListListSetting llSetting) {
+    private static boolean doAddListList(final JComponent gui, PrefEntry pe, ListListSetting llSetting) {
         ListListEditor llEditor = new ListListEditor(gui, pe, llSetting);
         llEditor.showDialog();
@@ -260,5 +263,5 @@
     }
 
-    static boolean doAddMapList(final JComponent gui, PrefEntry pe, MapListSetting mlSetting) {
+    private static boolean doAddMapList(final JComponent gui, PrefEntry pe, MapListSetting mlSetting) {
         MapListEditor mlEditor = new MapListEditor(gui, pe, mlSetting);
         mlEditor.showDialog();
@@ -279,10 +282,12 @@
     public void resetPreferences(final JComponent gui) {
         if (getSelectedRowCount() == 0) {
-            JOptionPane.showMessageDialog(
-                    gui,
-                    tr("Please select the row to delete."),
-                    tr("Warning"),
-                    JOptionPane.WARNING_MESSAGE
-                    );
+            if (!GraphicsEnvironment.isHeadless()) {
+                JOptionPane.showMessageDialog(
+                        gui,
+                        tr("Please select the row to delete."),
+                        tr("Warning"),
+                        JOptionPane.WARNING_MESSAGE
+                        );
+            }
             return;
         }
@@ -294,5 +299,5 @@
     }
 
-    private class AllSettingsTableModel extends DefaultTableModel {
+    final class AllSettingsTableModel extends DefaultTableModel {
 
         AllSettingsTableModel() {
@@ -329,5 +334,5 @@
     }
 
-    private static class SettingCellRenderer extends DefaultTableCellRenderer {
+    static final class SettingCellRenderer extends DefaultTableCellRenderer {
         private final Color backgroundColor = UIManager.getColor("Table.background");
         private final Color changedColor = Main.pref.getColor(
@@ -374,5 +379,5 @@
     }
 
-    private static class SettingCellEditor extends DefaultCellEditor {
+    static final class SettingCellEditor extends DefaultCellEditor {
         SettingCellEditor() {
             super(new JosmTextField());
Index: /trunk/test/unit/org/openstreetmap/josm/gui/preferences/advanced/PreferencesTableTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/gui/preferences/advanced/PreferencesTableTest.java	(revision 10109)
+++ /trunk/test/unit/org/openstreetmap/josm/gui/preferences/advanced/PreferencesTableTest.java	(revision 10109)
@@ -0,0 +1,68 @@
+// License: GPL. For details, see LICENSE file.
+package org.openstreetmap.josm.gui.preferences.advanced;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Arrays;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.openstreetmap.josm.JOSMFixture;
+import org.openstreetmap.josm.data.preferences.StringSetting;
+import org.openstreetmap.josm.gui.preferences.advanced.PreferencesTable.AllSettingsTableModel;
+
+/**
+ * Unit tests of {@link PreferencesTable} class.
+ */
+public class PreferencesTableTest {
+
+    /**
+     * Setup test.
+     */
+    @BeforeClass
+    public static void setUpBeforeClass() {
+        JOSMFixture.createUnitTestFixture().init();
+    }
+
+    private static PrefEntry newPrefEntry(String value) {
+        StringSetting val = new StringSetting(value);
+        StringSetting def = new StringSetting("defaultValue");
+        return new PrefEntry("key", val, def, false);
+    }
+
+    private static PreferencesTable newTable() {
+        return new PreferencesTable(Arrays.asList(newPrefEntry("value")));
+    }
+
+    /**
+     * Unit test of {@link PreferencesTable#PreferencesTable}.
+     */
+    @Test
+    public void testPreferencesTable()  {
+        PreferencesTable t = newTable();
+        t.fireDataChanged();
+        assertTrue(t.getSelectedItems().isEmpty());
+        assertFalse(t.editPreference(null));
+        assertNull(t.addPreference(null));
+        t.resetPreferences(null);
+    }
+
+    /**
+     * Unit test of {@link PreferencesTable.AllSettingsTableModel} class.
+     */
+    @Test
+    public void testAllSettingsTableModel()  {
+        AllSettingsTableModel model = (AllSettingsTableModel) newTable().getModel();
+        assertEquals(1, model.getRowCount());
+        assertFalse(model.isCellEditable(0, 0));
+        assertTrue(model.isCellEditable(0, 1));
+        assertEquals("key", model.getValueAt(0, 0));
+        assertEquals(newPrefEntry("value"), model.getValueAt(0, 1));
+        String foobar = "foobar";
+        model.setValueAt(foobar, 0, 1);
+        assertEquals(newPrefEntry(foobar), model.getValueAt(0, 1));
+    }
+}
