Index: /trunk/src/org/openstreetmap/josm/data/CustomConfigurator.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/CustomConfigurator.java	(revision 9497)
+++ /trunk/src/org/openstreetmap/josm/data/CustomConfigurator.java	(revision 9498)
@@ -64,14 +64,24 @@
 public final class CustomConfigurator {
 
+    private static StringBuilder summary = new StringBuilder();
+
     private CustomConfigurator() {
         // Hide default constructor for utils classes
     }
 
-    private static StringBuilder summary = new StringBuilder();
-
+    /**
+     * Log a formatted message.
+     * @param fmt format
+     * @param vars arguments
+     * @see String#format
+     */
     public static void log(String fmt, Object... vars) {
         summary.append(String.format(fmt, vars));
     }
 
+    /**
+     * Log a message.
+     * @param s message to log
+     */
     public static void log(String s) {
         summary.append(s);
@@ -79,4 +89,8 @@
     }
 
+    /**
+     * Returns the log.
+     * @return the log
+     */
     public static String getLog() {
         return summary.toString();
@@ -122,5 +136,5 @@
 
     /**
-     * Downloads file to one of JOSM standard folders nad unpack it as ZIP/JAR file
+     * Downloads file to one of JOSM standard folders and unpack it as ZIP/JAR file
      * @param address - URL to download
      * @param path - file path relative to base where to put downloaded file
@@ -223,5 +237,6 @@
         Map<String, Setting<?>> allSettings = Main.pref.getAllSettings();
         for (String key: allSettings.keySet()) {
-            if (key.matches(pattern)) keySet.add(key);
+            if (key.matches(pattern))
+                keySet.add(key);
         }
         exportPreferencesKeysToFile(fileName, append, keySet);
@@ -253,7 +268,7 @@
             Main.warn("Error getting preferences to save:" +ex.getMessage());
         }
-        if (root == null) return;
+        if (root == null)
+            return;
         try {
-
             Element newRoot = exportDocument.createElement("config");
             exportDocument.appendChild(newRoot);
@@ -459,5 +474,5 @@
             try {
                 this.mainPrefs = mainPrefs;
-                CustomConfigurator.summary = new StringBuilder();
+                summary = new StringBuilder();
                 engine = new ScriptEngineManager().getEngineByName("rhino");
                 engine.eval("API={}; API.pref={}; API.fragments={};");
@@ -482,6 +497,5 @@
 
         private void processXML(Document document) {
-            Element root = document.getDocumentElement();
-            processXmlFragment(root);
+            processXmlFragment(document.getDocumentElement());
         }
 
@@ -1027,5 +1041,5 @@
 
         for (Entry<String, List<Collection<String>>> e : listlistMap.entrySet()) {
-            @SuppressWarnings("unchecked")
+            @SuppressWarnings({ "unchecked", "rawtypes" })
             List<List<String>> value = (List) e.getValue();
             tmp.put(e.getKey(), new ListListSetting(value));
@@ -1149,7 +1163,7 @@
             "}\n";
 
-        // Execute conversion script
-        engine.eval(init);
-    }
+            // Execute conversion script
+            engine.eval(init);
+        }
     }
 }
Index: /trunk/test/unit/org/openstreetmap/josm/data/BoundsTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/data/BoundsTest.java	(revision 9497)
+++ /trunk/test/unit/org/openstreetmap/josm/data/BoundsTest.java	(revision 9498)
@@ -9,4 +9,7 @@
 import org.openstreetmap.josm.data.coor.LatLon;
 
+/**
+ * Unit tests for class {@link Bounds}.
+ */
 public class BoundsTest {
 
Index: /trunk/test/unit/org/openstreetmap/josm/data/CustomConfiguratorTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/data/CustomConfiguratorTest.java	(revision 9498)
+++ /trunk/test/unit/org/openstreetmap/josm/data/CustomConfiguratorTest.java	(revision 9498)
@@ -0,0 +1,81 @@
+// License: GPL. For details, see LICENSE file.
+package org.openstreetmap.josm.data;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.util.Arrays;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.openstreetmap.josm.JOSMFixture;
+import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.tools.Utils;
+
+/**
+ * Unit tests for class {@link CustomConfigurator}.
+ */
+public class CustomConfiguratorTest {
+
+    /**
+     * Setup test.
+     */
+    @BeforeClass
+    public static void setUp() {
+        JOSMFixture.createUnitTestFixture().init();
+    }
+
+    /**
+     * Test method for {@link CustomConfigurator#log}.
+     */
+    @Test
+    public void testLog() {
+        assertEquals("", CustomConfigurator.getLog());
+        CustomConfigurator.log("test");
+        assertEquals("test\n", CustomConfigurator.getLog());
+        CustomConfigurator.log("%d\n", 100);
+        assertEquals("test\n100\n", CustomConfigurator.getLog());
+        CustomConfigurator.log("test");
+        assertEquals("test\n100\ntest\n", CustomConfigurator.getLog());
+    }
+
+    /**
+     * Test method for {@link CustomConfigurator#exportPreferencesKeysToFile}.
+     * @throws IOException if any I/O error occurs
+     */
+    @Test
+    public void testExportPreferencesKeysToFile() throws IOException {
+        File tmp = File.createTempFile("josm.testExportPreferencesKeysToFile.lorem_ipsum", ".xml");
+
+        Main.pref.putCollection("lorem_ipsum", Arrays.asList(
+                "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
+                "Sed non risus. Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor.",
+                "Cras elementum ultrices diam. Maecenas ligula massa, varius a, semper congue, euismod non, mi.",
+                "Proin porttitor, orci nec nonummy molestie, enim est eleifend mi, non fermentum diam nisl sit amet erat.",
+                "Duis semper. Duis arcu massa, scelerisque vitae, consequat in, pretium a, enim.",
+                "Pellentesque congue. Ut in risus volutpat libero pharetra tempor. Cras vestibulum bibendum augue.",
+                "Praesent egestas leo in pede. Praesent blandit odio eu enim. Pellentesque sed dui ut augue blandit sodales.",
+                "Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aliquam nibh.",
+                "Mauris ac mauris sed pede pellentesque fermentum. Maecenas adipiscing ante non diam sodales hendrerit."));
+        CustomConfigurator.exportPreferencesKeysToFile(tmp.getAbsolutePath(), false, "lorem_ipsum");
+        String xml = Utils.join("\n", Files.readAllLines(tmp.toPath(), StandardCharsets.UTF_8));
+        assertTrue(xml.contains("<preferences operation=\"replace\">"));
+        for (String entry : Main.pref.getCollection("lorem_ipsum")) {
+            assertTrue(entry + "\nnot found in:\n" + xml, xml.contains(entry));
+        }
+
+        Main.pref.putCollection("test", Arrays.asList("11111111", "2222222", "333333333"));
+        CustomConfigurator.exportPreferencesKeysByPatternToFile(tmp.getAbsolutePath(), true, "test");
+        xml = Utils.join("\n", Files.readAllLines(tmp.toPath(), StandardCharsets.UTF_8));
+        assertTrue(xml.contains("<preferences operation=\"append\">"));
+        for (String entry : Main.pref.getCollection("test")) {
+            assertTrue(entry + "\nnot found in:\n" + xml, xml.contains(entry));
+        }
+
+        Utils.deleteFile(tmp);
+    }
+}
Index: /trunk/test/unit/org/openstreetmap/josm/data/projection/EllipsoidTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/data/projection/EllipsoidTest.java	(revision 9497)
+++ /trunk/test/unit/org/openstreetmap/josm/data/projection/EllipsoidTest.java	(revision 9498)
@@ -8,4 +8,7 @@
 import org.openstreetmap.josm.data.coor.LatLon;
 
+/**
+ * Unit tests for class {@link Ellipsoid}.
+ */
 public class EllipsoidTest {
 
Index: /trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionTest.java	(revision 9497)
+++ /trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionTest.java	(revision 9498)
@@ -13,4 +13,7 @@
 import org.openstreetmap.josm.data.coor.LatLon;
 
+/**
+ * Unit tests for class {@link Projection}.
+ */
 public class ProjectionTest {
 
