Index: /trunk/src/org/openstreetmap/josm/data/osm/NameFormatter.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/osm/NameFormatter.java	(revision 9202)
+++ /trunk/src/org/openstreetmap/josm/data/osm/NameFormatter.java	(revision 9203)
@@ -4,11 +4,40 @@
 import java.util.Comparator;
 
+/**
+ * Formats a name for a {@link OsmPrimitive}.
+ * @since 1990
+ */
 public interface NameFormatter {
+
+    /**
+     * Formats a name for a {@link Node}.
+     *
+     * @param node the node
+     * @return the name
+     */
     String format(Node node);
 
+    /**
+     * Formats a name for a {@link Way}.
+     *
+     * @param way the way
+     * @return the name
+     */
     String format(Way way);
 
+    /**
+     * Formats a name for a {@link Relation}.
+     *
+     * @param relation the relation
+     * @return the name
+     */
     String format(Relation relation);
 
+    /**
+     * Formats a name for a {@link Changeset}.
+     *
+     * @param changeset the changeset
+     * @return the name
+     */
     String format(Changeset changeset);
 
Index: /trunk/src/org/openstreetmap/josm/data/osm/history/HistoryNameFormatter.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/osm/history/HistoryNameFormatter.java	(revision 9202)
+++ /trunk/src/org/openstreetmap/josm/data/osm/history/HistoryNameFormatter.java	(revision 9203)
@@ -2,9 +2,32 @@
 package org.openstreetmap.josm.data.osm.history;
 
+/**
+ * Formats a name for a {@link HistoryOsmPrimitive}.
+ * @since 2686
+ */
 public interface HistoryNameFormatter {
+
+    /**
+     * Formats a name for a {@link HistoryNode}.
+     *
+     * @param node the node
+     * @return the name
+     */
     String format(HistoryNode node);
 
-    String format(HistoryWay node);
+    /**
+     * Formats a name for a {@link HistoryWay}.
+     *
+     * @param way the way
+     * @return the name
+     */
+    String format(HistoryWay way);
 
-    String format(HistoryRelation node);
+    /**
+     * Formats a name for a {@link HistoryRelation}.
+     *
+     * @param relation the relation
+     * @return the name
+     */
+    String format(HistoryRelation relation);
 }
Index: /trunk/src/org/openstreetmap/josm/gui/DefaultNameFormatter.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/DefaultNameFormatter.java	(revision 9202)
+++ /trunk/src/org/openstreetmap/josm/gui/DefaultNameFormatter.java	(revision 9203)
@@ -45,6 +45,7 @@
 
 /**
- * This is the default implementation of a {@link NameFormatter} for names of {@link OsmPrimitive}s.
- *
+ * This is the default implementation of a {@link NameFormatter} for names of {@link OsmPrimitive}s
+ * and {@link HistoryOsmPrimitive}s.
+ * @since 1990
  */
 public class DefaultNameFormatter implements NameFormatter, HistoryNameFormatter {
@@ -135,10 +136,4 @@
     }
 
-    /**
-     * Formats a name for a node
-     *
-     * @param node the node
-     * @return the name
-     */
     @Override
     public String format(Node node) {
@@ -211,11 +206,4 @@
     }
 
-
-    /**
-     * Formats a name for a way
-     *
-     * @param way the way
-     * @return the name
-     */
     @Override
     public String format(Way way) {
@@ -249,8 +237,8 @@
                 }
                 if (n == null) {
-                    n =     (way.get("highway") != null) ? tr("highway") :
-                                (way.get("railway") != null) ? tr("railway") :
-                                    (way.get("waterway") != null) ? tr("waterway") :
-                                            (way.get("landuse") != null) ? tr("landuse") : null;
+                    n = (way.get("highway") != null) ? tr("highway") :
+                            (way.get("railway") != null) ? tr("railway") :
+                                (way.get("waterway") != null) ? tr("waterway") :
+                                        (way.get("landuse") != null) ? tr("landuse") : null;
                 }
                 if (n == null) {
@@ -313,11 +301,4 @@
     }
 
-
-    /**
-     * Formats a name for a relation
-     *
-     * @param relation the relation
-     * @return the name
-     */
     @Override
     public String format(Relation relation) {
@@ -488,10 +469,4 @@
     }
 
-    /**
-     * Formats a name for a changeset
-     *
-     * @param changeset the changeset
-     * @return the name
-     */
     @Override
     public String format(Changeset changeset) {
@@ -554,10 +529,4 @@
     }
 
-    /**
-     * Formats a name for a history node
-     *
-     * @param node the node
-     * @return the name
-     */
     @Override
     public String format(HistoryNode node) {
@@ -586,10 +555,4 @@
     }
 
-    /**
-     * Formats a name for a way
-     *
-     * @param way the way
-     * @return the name
-     */
     @Override
     public String format(HistoryWay way) {
@@ -628,10 +591,4 @@
     }
 
-    /**
-     * Formats a name for a {@link HistoryRelation})
-     *
-     * @param relation the relation
-     * @return the name
-     */
     @Override
     public String format(HistoryRelation relation) {
@@ -684,4 +641,9 @@
     }
 
+    /**
+     * Formats the given collection of primitives as an HTML unordered list.
+     * @param primitives collection of primitives to format
+     * @return HTML unordered list
+     */
     public String formatAsHtmlUnorderedList(Collection<? extends OsmPrimitive> primitives) {
         return Utils.joinAsHtmlUnorderedList(Utils.transform(primitives, new Function<OsmPrimitive, String>() {
@@ -694,4 +656,9 @@
     }
 
+    /**
+     * Formats the given primitive(s) as an HTML unordered list.
+     * @param primitives primitive(s) to format
+     * @return HTML unordered list
+     */
     public String formatAsHtmlUnorderedList(OsmPrimitive... primitives) {
         return formatAsHtmlUnorderedList(Arrays.asList(primitives));
Index: /trunk/test/unit/org/openstreetmap/josm/data/osm/history/HistoryNodeTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/data/osm/history/HistoryNodeTest.java	(revision 9202)
+++ /trunk/test/unit/org/openstreetmap/josm/data/osm/history/HistoryNodeTest.java	(revision 9203)
@@ -6,9 +6,15 @@
 
 import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
 
+import org.junit.BeforeClass;
 import org.junit.Test;
+import org.openstreetmap.josm.JOSMFixture;
 import org.openstreetmap.josm.data.coor.LatLon;
+import org.openstreetmap.josm.data.osm.Node;
 import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
 import org.openstreetmap.josm.data.osm.User;
+import org.openstreetmap.josm.gui.DefaultNameFormatter;
 
 /**
@@ -17,16 +23,31 @@
 public class HistoryNodeTest {
 
-    @Test
-    public void historyNode() {
-        Date d = new Date();
-        HistoryNode node = new HistoryNode(
-                1L,
-                2L,
-                true,
+    /**
+     * Setup test.
+     */
+    @BeforeClass
+    public static void init() {
+        JOSMFixture.createUnitTestFixture().init();
+    }
+
+    private static HistoryNode create(Date d) {
+        return new HistoryNode(
+                1L,   // id
+                2L,   // version
+                true, // visible
                 User.createOsmUser(3, "testuser"),
-                4L,
-                d,
+                4L,   // changesetId
+                d,    // timestamp
                 new LatLon(0, 0)
                 );
+    }
+
+    /**
+     * Unit test for {@link HistoryNode#HistoryNode}.
+     */
+    @Test
+    public void testHistoryNode() {
+        Date d = new Date();
+        HistoryNode node = create(d);
 
         assertEquals(1, node.getId());
@@ -39,18 +60,42 @@
     }
 
+    /**
+     * Unit test for {@link HistoryNode#getType}.
+     */
     @Test
-    public void getType() {
-        Date d = new Date();
-        HistoryNode node = new HistoryNode(
-                1,
-                2,
-                true,
-                User.createOsmUser(3, "testuser"),
-                4,
-                d,
-                new LatLon(0, 0)
-                );
+    public void testGetType() {
+        assertEquals(OsmPrimitiveType.NODE, create(new Date()).getType());
+    }
 
-        assertEquals(OsmPrimitiveType.NODE, node.getType());
+    /**
+     * Unit test for {@link HistoryNode#getCoords}.
+     */
+    @Test
+    public void testGetCoords() {
+        Node n = new Node(new LatLon(45, 0));
+        n.setOsmId(1, 2);
+        n.setUser(User.createOsmUser(3, "testuser"));
+        n.setChangesetId(4);
+        assertEquals(n.getCoor(), new HistoryNode(n).getCoords());
+    }
+
+    /**
+     * Unit test for {@link HistoryNode#getDisplayName}.
+     */
+    @Test
+    public void testGetDisplayName() {
+        HistoryNode node = create(new Date());
+        HistoryNameFormatter hnf = DefaultNameFormatter.getInstance();
+        assertEquals("1 (0.0, 0.0)", node.getDisplayName(hnf));
+        LatLon ll = node.getCoords();
+        node.setCoords(null);
+        assertEquals("1", node.getDisplayName(hnf));
+        node.setCoords(ll);
+        Map<String, String> map = new HashMap<>();
+        map.put("name", "NodeName");
+        node.setTags(map);
+        assertEquals("NodeName (0.0, 0.0)", node.getDisplayName(hnf));
+        node.setCoords(null);
+        assertEquals("NodeName", node.getDisplayName(hnf));
     }
 }
Index: /trunk/test/unit/org/openstreetmap/josm/data/osm/history/HistoryRelationTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/data/osm/history/HistoryRelationTest.java	(revision 9203)
+++ /trunk/test/unit/org/openstreetmap/josm/data/osm/history/HistoryRelationTest.java	(revision 9203)
@@ -0,0 +1,97 @@
+// License: GPL. For details, see LICENSE file.
+package org.openstreetmap.josm.data.osm.history;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.openstreetmap.josm.JOSMFixture;
+import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
+import org.openstreetmap.josm.data.osm.RelationMemberData;
+import org.openstreetmap.josm.data.osm.User;
+import org.openstreetmap.josm.gui.DefaultNameFormatter;
+
+/**
+ * Unit tests for class {@link HistoryRelation}.
+ */
+public class HistoryRelationTest {
+
+    /**
+     * Setup test.
+     */
+    @BeforeClass
+    public static void init() {
+        JOSMFixture.createUnitTestFixture().init();
+    }
+
+    private static HistoryRelation create(Date d) {
+        return new HistoryRelation(
+                1,    // id
+                2,    // version
+                true, // visible
+                User.createOsmUser(3, "testuser"),
+                4,    // changesetId
+                d     // timestamp
+                );
+    }
+
+    /**
+     * Unit test for {@link HistoryRelation#HistoryRelation}.
+     */
+    @Test
+    public void testHistoryRelation() {
+        Date d = new Date();
+        HistoryRelation rel = create(d);
+
+        assertEquals(1, rel.getId());
+        assertEquals(2, rel.getVersion());
+        assertTrue(rel.isVisible());
+        assertEquals("testuser", rel.getUser().getName());
+        assertEquals(3, rel.getUser().getId());
+        assertEquals(4, rel.getChangesetId());
+        assertEquals(d, rel.getTimestamp());
+    }
+
+    /**
+     * Unit test for {@link HistoryRelation#getType}.
+     */
+    @Test
+    public void testGetType() {
+        assertEquals(OsmPrimitiveType.RELATION, create(new Date()).getType());
+    }
+
+    /**
+     * Unit test for {@link HistoryRelation#getDisplayName}.
+     */
+    @Test
+    public void testGetDisplayName() {
+        HistoryNameFormatter hnf = DefaultNameFormatter.getInstance();
+        HistoryRelation rel0 = create(new Date()); // 0 member
+        HistoryRelation rel1 = create(new Date()); // 1 member
+        HistoryRelation rel2 = create(new Date()); // 2 members
+
+        rel1.addMember(new RelationMemberData(null, OsmPrimitiveType.NODE, 1));
+        rel2.addMember(new RelationMemberData(null, OsmPrimitiveType.NODE, 1));
+        rel2.addMember(new RelationMemberData(null, OsmPrimitiveType.NODE, 2));
+
+        assertEquals("relation (1, 0 members)", rel0.getDisplayName(hnf));
+        assertEquals("relation (1, 1 member)",  rel1.getDisplayName(hnf));
+        assertEquals("relation (1, 2 members)", rel2.getDisplayName(hnf));
+
+        Map<String, String> map = new HashMap<>();
+        map.put("name", "RelName");
+
+        rel0.setTags(map);
+        rel1.setTags(map);
+        rel2.setTags(map);
+
+        assertEquals("relation (\"RelName\", 0 members)", rel0.getDisplayName(hnf));
+        assertEquals("relation (\"RelName\", 1 member)",  rel1.getDisplayName(hnf));
+        assertEquals("relation (\"RelName\", 2 members)", rel2.getDisplayName(hnf));
+    }
+}
Index: /trunk/test/unit/org/openstreetmap/josm/data/osm/history/HistoryWayTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/data/osm/history/HistoryWayTest.java	(revision 9202)
+++ /trunk/test/unit/org/openstreetmap/josm/data/osm/history/HistoryWayTest.java	(revision 9203)
@@ -8,9 +8,14 @@
 import java.util.ArrayList;
 import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
 
+import org.junit.BeforeClass;
 import org.junit.Test;
+import org.openstreetmap.josm.JOSMFixture;
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
 import org.openstreetmap.josm.data.osm.User;
+import org.openstreetmap.josm.gui.DefaultNameFormatter;
 
 /**
@@ -19,15 +24,30 @@
 public class HistoryWayTest {
 
+    /**
+     * Setup test.
+     */
+    @BeforeClass
+    public static void init() {
+        JOSMFixture.createUnitTestFixture().init();
+    }
+
+    private static HistoryWay create(Date d) {
+        return new HistoryWay(
+                1,    // id
+                2,    // version
+                true, // visible
+                User.createOsmUser(3, "testuser"),
+                4,    // changesetId
+                d     // timestamp
+                );
+    }
+
+    /**
+     * Unit test for {@link HistoryWay#HistoryWay}.
+     */
     @Test
-    public void wayTest() {
+    public void testHistoryWay() {
         Date d = new Date();
-        HistoryWay way = new HistoryWay(
-                1,
-                2,
-                true,
-                User.createOsmUser(3, "testuser"),
-                4,
-                d
-                );
+        HistoryWay way = create(d);
 
         assertEquals(1, way.getId());
@@ -42,30 +62,15 @@
     }
 
+    /**
+     * Unit test for {@link HistoryWay#getType}.
+     */
     @Test
-    public void getType() {
-        Date d = new Date();
-        HistoryWay way = new HistoryWay(
-                1,
-                2,
-                true,
-                User.createOsmUser(3, "testuser"),
-                4,
-                d
-                );
-
-        assertEquals(OsmPrimitiveType.WAY, way.getType());
+    public void testGetType() {
+        assertEquals(OsmPrimitiveType.WAY, create(new Date()).getType());
     }
 
     @Test
-    public void nodeManipulation() {
-        Date d = new Date();
-        HistoryWay way = new HistoryWay(
-                1,
-                2,
-                true,
-                User.createOsmUser(3, "testuser"),
-                4,
-                d
-                );
+    public void testNodeManipulation() {
+        HistoryWay way = create(new Date());
 
         way.addNode(1);
@@ -88,14 +93,6 @@
 
     @Test
-    public void iterating() {
-        Date d = new Date();
-        HistoryWay way = new HistoryWay(
-                1,
-                2,
-                true,
-                User.createOsmUser(3, "testuser"),
-                4,
-                d
-                );
+    public void testIterating() {
+        HistoryWay way = create(new Date());
 
         way.addNode(1);
@@ -110,3 +107,33 @@
         assertEquals(2, (long) ids.get(1));
     }
+
+    /**
+     * Unit test for {@link HistoryWay#getDisplayName}.
+     */
+    @Test
+    public void testGetDisplayName() {
+        HistoryNameFormatter hnf = DefaultNameFormatter.getInstance();
+        HistoryWay way0 = create(new Date()); // no node
+        HistoryWay way1 = create(new Date()); // 1 node
+        HistoryWay way2 = create(new Date()); // 2 nodes
+
+        way1.addNode(1);
+        way2.addNode(1);
+        way2.addNode(2);
+
+        assertEquals("1 (0 nodes)", way0.getDisplayName(hnf));
+        assertEquals("1 (1 node)",  way1.getDisplayName(hnf));
+        assertEquals("1 (2 nodes)", way2.getDisplayName(hnf));
+
+        Map<String, String> map = new HashMap<>();
+        map.put("name", "WayName");
+
+        way0.setTags(map);
+        way1.setTags(map);
+        way2.setTags(map);
+
+        assertEquals("WayName (0 nodes)", way0.getDisplayName(hnf));
+        assertEquals("WayName (1 node)",  way1.getDisplayName(hnf));
+        assertEquals("WayName (2 nodes)", way2.getDisplayName(hnf));
+    }
 }
