Index: trunk/test/unit/org/openstreetmap/josm/command/SequenceCommandTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/command/SequenceCommandTest.java	(revision 16560)
+++ trunk/test/unit/org/openstreetmap/josm/command/SequenceCommandTest.java	(revision 16574)
@@ -5,5 +5,7 @@
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotSame;
 import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
@@ -298,3 +300,16 @@
         }
     }
+
+    /**
+     * Test {@link SequenceCommand#wrapIfNeeded}
+     */
+    @Test
+    public void testWrapIfNeeded() {
+        DataSet ds = new DataSet();
+        TestCommand command1 = new TestCommand(ds, Collections.<OsmPrimitive>singletonList(testData.existingNode));
+        TestCommand command2 = new TestCommand(ds, Collections.<OsmPrimitive>singletonList(testData.existingNode2));
+        assertSame(command1, SequenceCommand.wrapIfNeeded("foo", command1));
+        assertNotSame(command1, SequenceCommand.wrapIfNeeded("foo", command1, command2));
+        assertEquals(new SequenceCommand("foo", command1, command2), SequenceCommand.wrapIfNeeded("foo", command1, command2));
+    }
 }
