Index: trunk/test/unit/org/openstreetmap/josm/command/SequenceCommandTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/command/SequenceCommandTest.java	(revision 11733)
+++ trunk/test/unit/org/openstreetmap/josm/command/SequenceCommandTest.java	(revision 11734)
@@ -96,4 +96,39 @@
         assertTrue(command1.executed);
         assertTrue(command2.executed);
+    }
+
+    /**
+     * Test {@link SequenceCommand#executeCommand()} rollback if case of subcommand failure.
+     */
+    @Test
+    public void testExecuteRollback() {
+        TestCommand command1 = new TestCommand(null);
+        FailingCommand command2 = new FailingCommand();
+        TestCommand command3 = new TestCommand(null);
+        SequenceCommand command = new SequenceCommand("seq", Arrays.<Command>asList(command1, command2, command3));
+        assertFalse(command.executeCommand());
+        assertFalse(command1.executed);
+        // Don't check command2 executed state as it's possible but not necessary to undo failed commands
+        assertFalse(command3.executed);
+        command.undoCommand();
+    }
+
+    /**
+     * Test {@link SequenceCommand#executeCommand()} with continueOnError = true
+     */
+    @Test
+    public void testContinueOnErrors() {
+        TestCommand command1 = new TestCommand(null);
+        FailingCommand command2 = new FailingCommand();
+        TestCommand command3 = new TestCommand(null);
+        SequenceCommand command = new SequenceCommand("seq", Arrays.<Command>asList(command1, command2, command3));
+        command.continueOnError = true;
+        assertTrue(command.executeCommand());
+        assertTrue(command1.executed);
+        assertTrue(command3.executed);
+        command.undoCommand();
+        assertFalse(command1.executed);
+        // Don't check command2 executed state as it's possible but not necessary to undo failed commands
+        assertFalse(command3.executed);
     }
 
@@ -229,3 +264,29 @@
 
     }
+
+    private static class FailingCommand extends TestCommand {
+
+        FailingCommand() {
+            super(null);
+        }
+
+        @Override
+        public boolean executeCommand() {
+            executed = true;
+            return false;
+        }
+
+        @Override
+        public void undoCommand() {
+            assertTrue("Cannot undo without execute", executed);
+            executed = false;
+        }
+
+        @Override
+        public String toString() {
+            return "FailingCommand";
+        }
+
+    }
+
 }
