Index: trunk/src/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelper.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelper.java	(revision 12618)
+++ trunk/src/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelper.java	(revision 12619)
@@ -108,5 +108,5 @@
     private String objKey;
 
-    private final Comparator<AutoCompletionListItem> defaultACItemComparator =
+    static final Comparator<AutoCompletionListItem> DEFAULT_AC_ITEM_COMPARATOR =
             (o1, o2) -> String.CASE_INSENSITIVE_ORDER.compare(o1.getValue(), o2.getValue());
 
@@ -204,5 +204,5 @@
      */
     @SuppressWarnings("unchecked")
-    private boolean containsDataKey(String key) {
+    boolean containsDataKey(String key) {
         return IntStream.range(0, tagData.getRowCount())
                 .anyMatch(i -> key.equals(tagData.getValueAt(i, 0)) /* sic! do not use getDataKey*/
@@ -444,5 +444,5 @@
             AutoCompletionManager autocomplete = Main.getLayerManager().getEditLayer().data.getAutoCompletionManager();
             List<AutoCompletionListItem> keyList = autocomplete.getKeys();
-            keyList.sort(defaultACItemComparator);
+            keyList.sort(DEFAULT_AC_ITEM_COMPARATOR);
 
             keys = new AutoCompletingComboBox(key);
@@ -696,5 +696,5 @@
             keyList.removeIf(item -> containsDataKey(item.getValue()));
 
-            keyList.sort(defaultACItemComparator);
+            keyList.sort(DEFAULT_AC_ITEM_COMPARATOR);
             keys.setPossibleACItems(keyList);
             keys.setEditable(true);
@@ -715,5 +715,5 @@
                     });
 
-            focus = addFocusAdapter(autocomplete, defaultACItemComparator);
+            focus = addFocusAdapter(autocomplete, DEFAULT_AC_ITEM_COMPARATOR);
             // fire focus event in advance or otherwise the popup list will be too small at first
             focus.focusGained(null);
Index: trunk/test/unit/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelperTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelperTest.java	(revision 12619)
+++ trunk/test/unit/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelperTest.java	(revision 12619)
@@ -0,0 +1,68 @@
+// License: GPL. For details, see LICENSE file.
+package org.openstreetmap.josm.gui.dialogs.properties;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+import javax.swing.JTable;
+import javax.swing.table.DefaultTableModel;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionListItem;
+import org.openstreetmap.josm.testutils.JOSMTestRules;
+
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+
+/**
+ * Unit tests of {@link TagEditHelper} class.
+ */
+public class TagEditHelperTest {
+
+    /**
+     * Setup tests
+     */
+    @Rule
+    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
+    public JOSMTestRules test = new JOSMTestRules();
+
+    private static TagEditHelper newTagEditHelper() {
+        DefaultTableModel propertyData = new DefaultTableModel();
+        JTable tagTable = new JTable(propertyData);
+        Map<String, Map<String, Integer>> valueCount = new HashMap<>();
+        return new TagEditHelper(tagTable, propertyData, valueCount);
+    }
+
+    /**
+     * Checks that autocompleting list items are sorted correctly.
+     */
+    @Test
+    public void testAcItemComparator() {
+        List<AutoCompletionListItem> list = new ArrayList<>();
+        list.add(new AutoCompletionListItem("Bing Sat"));
+        list.add(new AutoCompletionListItem("survey"));
+        list.add(new AutoCompletionListItem("Bing"));
+        list.add(new AutoCompletionListItem("digitalglobe"));
+        list.add(new AutoCompletionListItem("bing"));
+        list.add(new AutoCompletionListItem("DigitalGlobe"));
+        list.sort(TagEditHelper.DEFAULT_AC_ITEM_COMPARATOR);
+        assertEquals(Arrays.asList("Bing", "bing", "Bing Sat", "digitalglobe", "DigitalGlobe", "survey"),
+                list.stream().map(AutoCompletionListItem::getValue).collect(Collectors.toList()));
+    }
+
+    /**
+     * Unit test of {@link TagEditHelper#containsDataKey}.
+     */
+    @Test
+    public void testContainsDataKey() {
+        assertFalse(newTagEditHelper().containsDataKey("foo"));
+        // TODO: complete test
+    }
+}
