Index: trunk/test/unit/org/openstreetmap/josm/TestUtils.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/TestUtils.java	(revision 12719)
+++ trunk/test/unit/org/openstreetmap/josm/TestUtils.java	(revision 12726)
@@ -22,4 +22,5 @@
 
 import org.openstreetmap.josm.command.Command;
+import org.openstreetmap.josm.data.osm.DataSet;
 import org.openstreetmap.josm.data.osm.Node;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
@@ -257,8 +258,9 @@
     /**
      * Creates a new empty command.
+     * @param ds data set
      * @return a new empty command
      */
-    public static Command newCommand() {
-        return new Command() {
+    public static Command newCommand(DataSet ds) {
+        return new Command(ds) {
             @Override
             public String getDescriptionText() {
Index: trunk/test/unit/org/openstreetmap/josm/actions/CreateMultipolygonActionTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/actions/CreateMultipolygonActionTest.java	(revision 12719)
+++ trunk/test/unit/org/openstreetmap/josm/actions/CreateMultipolygonActionTest.java	(revision 12726)
@@ -17,7 +17,7 @@
 import org.openstreetmap.josm.data.osm.RelationMember;
 import org.openstreetmap.josm.data.osm.Way;
+import org.openstreetmap.josm.data.osm.search.SearchCompiler;
 import org.openstreetmap.josm.data.osm.search.SearchParseError;
 import org.openstreetmap.josm.data.osm.search.SearchSetting;
-import org.openstreetmap.josm.data.osm.search.SearchCompiler;
 import org.openstreetmap.josm.io.OsmReader;
 import org.openstreetmap.josm.testutils.JOSMTestRules;
@@ -42,5 +42,8 @@
         Map<String, String> refToRole = new TreeMap<>();
         for (RelationMember i : relation.getMembers()) {
-            refToRole.put(i.getMember().get("ref"), i.getRole());
+            String ref = i.getMember().get("ref");
+            if (ref != null) {
+                refToRole.put(ref, i.getRole());
+            }
         }
         return refToRole;
Index: trunk/test/unit/org/openstreetmap/josm/actions/SplitWayActionTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/actions/SplitWayActionTest.java	(revision 12719)
+++ trunk/test/unit/org/openstreetmap/josm/actions/SplitWayActionTest.java	(revision 12726)
@@ -162,5 +162,4 @@
     void doTestRouteRelation(final boolean wayIsReversed, final int indexOfWayToKeep) {
         final DataSet dataSet = new DataSet();
-        final OsmDataLayer layer = new OsmDataLayer(dataSet, OsmDataLayer.createNewName(), null);
         final Node n1 = new Node(new LatLon(1, 0));
         final Node n2 = new Node(new LatLon(2, 0));
@@ -197,5 +196,5 @@
             };
         final SplitWayAction.SplitWayResult result = SplitWayAction.splitWay(
-                layer, w2, SplitWayAction.buildSplitChunks(w2, Arrays.asList(n3, n4, n5)), new ArrayList<OsmPrimitive>(), strategy);
+                w2, SplitWayAction.buildSplitChunks(w2, Arrays.asList(n3, n4, n5)), new ArrayList<OsmPrimitive>(), strategy);
         MainApplication.undoRedo.add(result.getCommand());
 
Index: trunk/test/unit/org/openstreetmap/josm/command/AddCommandTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/command/AddCommandTest.java	(revision 12719)
+++ trunk/test/unit/org/openstreetmap/josm/command/AddCommandTest.java	(revision 12726)
@@ -16,5 +16,4 @@
 import org.openstreetmap.josm.data.osm.User;
 import org.openstreetmap.josm.data.osm.Way;
-import org.openstreetmap.josm.gui.MainApplication;
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
 import org.openstreetmap.josm.testutils.JOSMTestRules;
@@ -41,32 +40,28 @@
     @Test
     public void testAdd() {
-        OsmDataLayer layer1 = new OsmDataLayer(new DataSet(), "l1", null);
-        MainApplication.getLayerManager().addLayer(layer1);
-        assertArrayEquals(new Object[0], layer1.data.allPrimitives().toArray());
+        DataSet ds = new DataSet();
+        assertArrayEquals(new Object[0], ds.allPrimitives().toArray());
 
         Node osm = new Node(LatLon.ZERO);
-        assertTrue(new AddCommand(osm).executeCommand());
+        assertTrue(new AddCommand(ds, osm).executeCommand());
 
-        assertArrayEquals(new Object[] {osm}, layer1.data.allPrimitives().toArray());
-        assertArrayEquals(new Object[] {osm}, layer1.data.allModifiedPrimitives().toArray());
+        assertArrayEquals(new Object[] {osm}, ds.allPrimitives().toArray());
+        assertArrayEquals(new Object[] {osm}, ds.allModifiedPrimitives().toArray());
         assertTrue(osm.isModified());
     }
 
     /**
-     * Tests if the add command respects the layer.
+     * Tests if the add command respects the data set.
      */
     @Test
     public void testAddToLayer() {
-        OsmDataLayer layer1 = new OsmDataLayer(new DataSet(), "l1", null);
-        OsmDataLayer layer2 = new OsmDataLayer(new DataSet(), "l1", null);
-
-        MainApplication.getLayerManager().addLayer(layer1);
-        MainApplication.getLayerManager().addLayer(layer2);
+        DataSet ds1 = new DataSet();
+        DataSet ds2 = new DataSet();
 
         Node osm = new Node(LatLon.ZERO);
-        assertTrue(new AddCommand(layer2, osm).executeCommand());
+        assertTrue(new AddCommand(ds2, osm).executeCommand());
 
-        assertArrayEquals(new Object[0], layer1.data.allPrimitives().toArray());
-        assertArrayEquals(new Object[] {osm}, layer2.data.allPrimitives().toArray());
+        assertArrayEquals(new Object[0], ds1.allPrimitives().toArray());
+        assertArrayEquals(new Object[] {osm}, ds2.allPrimitives().toArray());
     }
 
@@ -76,14 +71,12 @@
     @Test
     public void testUndo() {
-        OsmDataLayer layer1 = new OsmDataLayer(new DataSet(), "l1", null);
-        MainApplication.getLayerManager().addLayer(layer1);
         Node osm = new Node(LatLon.ZERO);
-        layer1.data.addPrimitive(osm);
+        DataSet ds = new DataSet(osm);
 
-        AddCommand command = new AddCommand(new Node(LatLon.ZERO));
+        AddCommand command = new AddCommand(ds, new Node(LatLon.ZERO));
         command.executeCommand();
 
         command.undoCommand();
-        assertArrayEquals(new Object[] {osm}, layer1.data.allPrimitives().toArray());
+        assertArrayEquals(new Object[] {osm}, ds.allPrimitives().toArray());
     }
 
@@ -95,5 +88,5 @@
         Node osm = new Node(LatLon.ZERO);
 
-        assertArrayEquals(new Object[] {osm}, new AddCommand(osm).getParticipatingPrimitives().toArray());
+        assertArrayEquals(new Object[] {osm}, new AddCommand(new DataSet(), osm).getParticipatingPrimitives().toArray());
     }
 
@@ -108,5 +101,5 @@
         ArrayList<OsmPrimitive> deleted = new ArrayList<>();
         ArrayList<OsmPrimitive> added = new ArrayList<>();
-        new AddCommand(osm).fillModifiedData(modified, deleted, added);
+        new AddCommand(new DataSet(), osm).fillModifiedData(modified, deleted, added);
         assertArrayEquals(new Object[] {}, modified.toArray());
         assertArrayEquals(new Object[] {}, deleted.toArray());
@@ -127,7 +120,8 @@
         relation.put("name", "xy");
 
-        assertTrue(new AddCommand(node).getDescriptionText().matches("Add node.*xy.*"));
-        assertTrue(new AddCommand(way).getDescriptionText().matches("Add way.*xy.*"));
-        assertTrue(new AddCommand(relation).getDescriptionText().matches("Add relation.*xy.*"));
+        DataSet ds = new DataSet();
+        assertTrue(new AddCommand(ds, node).getDescriptionText().matches("Add node.*xy.*"));
+        assertTrue(new AddCommand(ds, way).getDescriptionText().matches("Add way.*xy.*"));
+        assertTrue(new AddCommand(ds, relation).getDescriptionText().matches("Add relation.*xy.*"));
     }
 
Index: trunk/test/unit/org/openstreetmap/josm/command/AddPrimitivesCommandTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/command/AddPrimitivesCommandTest.java	(revision 12719)
+++ trunk/test/unit/org/openstreetmap/josm/command/AddPrimitivesCommandTest.java	(revision 12726)
@@ -23,5 +23,4 @@
 import org.openstreetmap.josm.data.osm.Way;
 import org.openstreetmap.josm.data.osm.WayData;
-import org.openstreetmap.josm.gui.MainApplication;
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
 import org.openstreetmap.josm.testutils.JOSMTestRules;
@@ -48,12 +47,11 @@
     @Test
     public void testAdd() {
-        OsmDataLayer layer1 = new OsmDataLayer(new DataSet(), "l1", null);
-        MainApplication.getLayerManager().addLayer(layer1);
-
-        List<PrimitiveData> testData = createTestData();
-        assertTrue(new AddPrimitivesCommand(testData).executeCommand());
-
-        testContainsTestData(layer1);
-        assertEquals(3, layer1.data.getAllSelected().size());
+        DataSet ds = new DataSet();
+
+        List<PrimitiveData> testData = createTestData();
+        assertTrue(new AddPrimitivesCommand(testData, ds).executeCommand());
+
+        testContainsTestData(ds);
+        assertEquals(3, ds.getAllSelected().size());
     }
 
@@ -63,35 +61,31 @@
     @Test
     public void testAddSetSelection() {
-        OsmDataLayer layer1 = new OsmDataLayer(new DataSet(), "l1", null);
-        MainApplication.getLayerManager().addLayer(layer1);
-
-        List<PrimitiveData> testData = createTestData();
-        assertTrue(new AddPrimitivesCommand(testData, testData.subList(2, 3)).executeCommand());
-
-        testContainsTestData(layer1);
-
-        assertEquals(1, layer1.data.getAllSelected().size());
-        assertEquals(1, layer1.data.getSelectedWays().size());
-    }
-
-    /**
-     * Tests if the add command respects the layer.
+        DataSet ds = new DataSet();
+
+        List<PrimitiveData> testData = createTestData();
+        assertTrue(new AddPrimitivesCommand(testData, testData.subList(2, 3), ds).executeCommand());
+
+        testContainsTestData(ds);
+
+        assertEquals(1, ds.getAllSelected().size());
+        assertEquals(1, ds.getSelectedWays().size());
+    }
+
+    /**
+     * Tests if the add command respects the data set.
      */
     @Test
     public void testAddToLayer() {
-        OsmDataLayer layer1 = new OsmDataLayer(new DataSet(), "l1", null);
-        OsmDataLayer layer2 = new OsmDataLayer(new DataSet(), "l1", null);
-
-        MainApplication.getLayerManager().addLayer(layer1);
-        MainApplication.getLayerManager().addLayer(layer2);
-
-        List<PrimitiveData> testData = createTestData();
-        assertTrue(new AddPrimitivesCommand(testData, testData.subList(2, 3), layer1).executeCommand());
-
-        testContainsTestData(layer1);
-        assertTrue(layer2.data.allPrimitives().isEmpty());
-
-        assertEquals(1, layer1.data.getAllSelected().size());
-        assertEquals(1, layer1.data.getSelectedWays().size());
+        DataSet ds1 = new DataSet();
+        DataSet ds2 = new DataSet();
+
+        List<PrimitiveData> testData = createTestData();
+        assertTrue(new AddPrimitivesCommand(testData, testData.subList(2, 3), ds1).executeCommand());
+
+        testContainsTestData(ds1);
+        assertTrue(ds2.allPrimitives().isEmpty());
+
+        assertEquals(1, ds1.getAllSelected().size());
+        assertEquals(1, ds1.getSelectedWays().size());
     }
 
@@ -101,17 +95,16 @@
     @Test
     public void testAddIgnoresExisting() {
-        OsmDataLayer layer1 = new OsmDataLayer(new DataSet(), "l1", null);
-        MainApplication.getLayerManager().addLayer(layer1);
-
-        List<PrimitiveData> testData = createTestData();
-        assertTrue(new AddPrimitivesCommand(testData).executeCommand());
-        assertEquals(2, layer1.data.getNodes().size());
-        assertEquals(1, layer1.data.getWays().size());
+        DataSet ds = new DataSet();
+
+        List<PrimitiveData> testData = createTestData();
+        assertTrue(new AddPrimitivesCommand(testData, ds).executeCommand());
+        assertEquals(2, ds.getNodes().size());
+        assertEquals(1, ds.getWays().size());
 
         testData.set(2, createTestNode(7));
-        assertTrue(new AddPrimitivesCommand(testData).executeCommand());
-
-        assertEquals(3, layer1.data.getNodes().size());
-        assertEquals(1, layer1.data.getWays().size());
+        assertTrue(new AddPrimitivesCommand(testData, ds).executeCommand());
+
+        assertEquals(3, ds.getNodes().size());
+        assertEquals(1, ds.getWays().size());
     }
 
@@ -121,12 +114,11 @@
     @Test
     public void testDescription() {
-        OsmDataLayer layer1 = new OsmDataLayer(new DataSet(), "l1", null);
-        MainApplication.getLayerManager().addLayer(layer1);
+        DataSet ds = new DataSet();
 
         List<PrimitiveData> testData = createTestData();
         NodeData data2 = createTestNode(7);
 
-        AddPrimitivesCommand command1 = new AddPrimitivesCommand(testData);
-        AddPrimitivesCommand command2 = new AddPrimitivesCommand(Arrays.<PrimitiveData>asList(data2));
+        AddPrimitivesCommand command1 = new AddPrimitivesCommand(testData, ds);
+        AddPrimitivesCommand command2 = new AddPrimitivesCommand(Arrays.<PrimitiveData>asList(data2), ds);
 
         assertEquals("Added 3 objects", command1.getDescriptionText());
@@ -146,16 +138,15 @@
     @Test
     public void testUndo() {
-        OsmDataLayer layer1 = new OsmDataLayer(new DataSet(), "l1", null);
-        MainApplication.getLayerManager().addLayer(layer1);
-
-        List<PrimitiveData> testData = createTestData();
-
-        AddPrimitivesCommand command = new AddPrimitivesCommand(testData);
+        DataSet ds = new DataSet();
+
+        List<PrimitiveData> testData = createTestData();
+
+        AddPrimitivesCommand command = new AddPrimitivesCommand(testData, ds);
 
         assertTrue(command.executeCommand());
 
-        assertEquals(3, layer1.data.allPrimitives().size());
-        assertEquals(1, layer1.data.getWays().size());
-        Way way = layer1.data.getWays().iterator().next();
+        assertEquals(3, ds.allPrimitives().size());
+        assertEquals(1, ds.getWays().size());
+        Way way = ds.getWays().iterator().next();
 
         for (int i = 0; i < 2; i++) {
@@ -163,13 +154,13 @@
             command.undoCommand();
 
-            assertEquals(0, layer1.data.allPrimitives().size());
-            assertEquals(0, layer1.data.getWays().size());
+            assertEquals(0, ds.allPrimitives().size());
+            assertEquals(0, ds.getWays().size());
 
             // redo
             assertTrue(command.executeCommand());
 
-            assertEquals(3, layer1.data.allPrimitives().size());
-            assertEquals(1, layer1.data.getWays().size());
-            assertSame(way, layer1.data.getWays().iterator().next());
+            assertEquals(3, ds.allPrimitives().size());
+            assertEquals(1, ds.getWays().size());
+            assertSame(way, ds.getWays().iterator().next());
         }
     }
@@ -181,21 +172,20 @@
     @Test
     public void testUndoIgnoresExisting() {
-        OsmDataLayer layer1 = new OsmDataLayer(new DataSet(), "l1", null);
-        MainApplication.getLayerManager().addLayer(layer1);
-
-        List<PrimitiveData> testData = createTestData();
-
-        assertTrue(new AddPrimitivesCommand(testData).executeCommand());
-        assertEquals(2, layer1.data.getNodes().size());
-        assertEquals(1, layer1.data.getWays().size());
+        DataSet ds = new DataSet();
+
+        List<PrimitiveData> testData = createTestData();
+
+        assertTrue(new AddPrimitivesCommand(testData, ds).executeCommand());
+        assertEquals(2, ds.getNodes().size());
+        assertEquals(1, ds.getWays().size());
 
         testData.set(2, createTestNode(7));
 
-        AddPrimitivesCommand command = new AddPrimitivesCommand(testData);
+        AddPrimitivesCommand command = new AddPrimitivesCommand(testData, ds);
 
         assertTrue(command.executeCommand());
 
-        assertEquals(3, layer1.data.getNodes().size());
-        assertEquals(1, layer1.data.getWays().size());
+        assertEquals(3, ds.getNodes().size());
+        assertEquals(1, ds.getWays().size());
 
         for (int i = 0; i < 2; i++) {
@@ -203,12 +193,12 @@
             command.undoCommand();
 
-            assertEquals(2, layer1.data.getNodes().size());
-            assertEquals(1, layer1.data.getWays().size());
+            assertEquals(2, ds.getNodes().size());
+            assertEquals(1, ds.getWays().size());
 
             // redo
             assertTrue(command.executeCommand());
 
-            assertEquals(3, layer1.data.getNodes().size());
-            assertEquals(1, layer1.data.getWays().size());
+            assertEquals(3, ds.getNodes().size());
+            assertEquals(1, ds.getWays().size());
         }
     }
@@ -219,13 +209,12 @@
     @Test
     public void testParticipatingPrimitives() {
-        OsmDataLayer layer1 = new OsmDataLayer(new DataSet(), "l1", null);
-        MainApplication.getLayerManager().addLayer(layer1);
-
-        List<PrimitiveData> testData = createTestData();
-        AddPrimitivesCommand command = new AddPrimitivesCommand(testData);
+        DataSet ds = new DataSet();
+
+        List<PrimitiveData> testData = createTestData();
+        AddPrimitivesCommand command = new AddPrimitivesCommand(testData, ds);
         assertTrue(command.executeCommand());
 
         assertEquals(3, command.getParticipatingPrimitives().size());
-        HashSet<OsmPrimitive> should = new HashSet<>(layer1.data.allPrimitives());
+        HashSet<OsmPrimitive> should = new HashSet<>(ds.allPrimitives());
         assertEquals(should, new HashSet<>(command.getParticipatingPrimitives()));
 
@@ -245,5 +234,5 @@
 
         List<PrimitiveData> testData = createTestData();
-        new AddPrimitivesCommand(testData).fillModifiedData(modified, deleted, added);
+        new AddPrimitivesCommand(testData, new DataSet()).fillModifiedData(modified, deleted, added);
 
         assertArrayEquals(new Object[] {}, modified.toArray());
@@ -252,19 +241,19 @@
     }
 
-    private void testContainsTestData(OsmDataLayer layer1) {
-        assertEquals(3, layer1.data.allPrimitives().size());
-        assertEquals(2, layer1.data.getNodes().size());
-        assertEquals(1, layer1.data.getWays().size());
-        assertEquals(3, layer1.data.allModifiedPrimitives().size());
-        for (OsmPrimitive n : layer1.data.allPrimitives()) {
+    private void testContainsTestData(DataSet data) {
+        assertEquals(3, data.allPrimitives().size());
+        assertEquals(2, data.getNodes().size());
+        assertEquals(1, data.getWays().size());
+        assertEquals(3, data.allModifiedPrimitives().size());
+        for (OsmPrimitive n : data.allPrimitives()) {
             assertEquals("test", n.get("test"));
             assertTrue(n.isModified());
         }
 
-        for (Node n : layer1.data.getNodes()) {
+        for (Node n : data.getNodes()) {
             assertEquals(LatLon.ZERO, n.getCoor());
         }
 
-        for (Way w : layer1.data.getWays()) {
+        for (Way w : data.getWays()) {
             assertEquals(2, w.getNodes().size());
             assertEquals(5, w.getNode(0).getId());
Index: trunk/test/unit/org/openstreetmap/josm/command/ChangeCommandTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/command/ChangeCommandTest.java	(revision 12719)
+++ trunk/test/unit/org/openstreetmap/josm/command/ChangeCommandTest.java	(revision 12726)
@@ -142,8 +142,9 @@
         Relation relation = new Relation();
         relation.put("name", "xy");
+        DataSet ds = new DataSet(node, way, relation);
 
-        assertTrue(new ChangeCommand(node, node).getDescriptionText().matches("Change node.*xy.*"));
-        assertTrue(new ChangeCommand(way, way).getDescriptionText().matches("Change way.*xy.*"));
-        assertTrue(new ChangeCommand(relation, relation).getDescriptionText().matches("Change relation.*xy.*"));
+        assertTrue(new ChangeCommand(ds, node, node).getDescriptionText().matches("Change node.*xy.*"));
+        assertTrue(new ChangeCommand(ds, way, way).getDescriptionText().matches("Change way.*xy.*"));
+        assertTrue(new ChangeCommand(ds, relation, relation).getDescriptionText().matches("Change relation.*xy.*"));
     }
 
Index: trunk/test/unit/org/openstreetmap/josm/command/ChangeNodesCommandTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/command/ChangeNodesCommandTest.java	(revision 12719)
+++ trunk/test/unit/org/openstreetmap/josm/command/ChangeNodesCommandTest.java	(revision 12726)
@@ -115,7 +115,7 @@
         way.addNode(node);
         way.put("name", "xy");
-
+        DataSet ds = new DataSet(node, way);
         assertTrue(
-                new ChangeNodesCommand(way, Arrays.asList(node)).getDescriptionText().matches("Change nodes of.*xy.*"));
+                new ChangeNodesCommand(ds, way, Arrays.asList(node)).getDescriptionText().matches("Change nodes of.*xy.*"));
     }
 
Index: trunk/test/unit/org/openstreetmap/josm/command/ChangePropertyCommandTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/command/ChangePropertyCommandTest.java	(revision 12719)
+++ trunk/test/unit/org/openstreetmap/josm/command/ChangePropertyCommandTest.java	(revision 12726)
@@ -201,9 +201,8 @@
         tagsRemove.put("existing", "");
 
-        Way way = new Way();
-        way.addNode(node1);
+        Way way = testData.createWay(20, node1);
         way.put("name", "xy");
         way.put("existing", "existing");
-        Relation relation = new Relation();
+        Relation relation = testData.createRelation(30);
         relation.put("name", "xy");
         relation.put("existing", "existing");
Index: trunk/test/unit/org/openstreetmap/josm/command/CommandTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/command/CommandTest.java	(revision 12719)
+++ trunk/test/unit/org/openstreetmap/josm/command/CommandTest.java	(revision 12726)
@@ -2,10 +2,6 @@
 package org.openstreetmap.josm.command;
 
-import static org.junit.Assert.assertSame;
+import java.util.Arrays;
 
-import java.util.Arrays;
-import java.util.Collection;
-
-import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
@@ -13,5 +9,4 @@
 import org.openstreetmap.josm.data.osm.DataSet;
 import org.openstreetmap.josm.data.osm.Node;
-import org.openstreetmap.josm.data.osm.OsmPrimitive;
 import org.openstreetmap.josm.data.osm.Relation;
 import org.openstreetmap.josm.data.osm.RelationMember;
@@ -37,27 +32,4 @@
     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
     public JOSMTestRules test = new JOSMTestRules().preferences().i18n();
-    private CommandTestData testData;
-
-    /**
-     * Set up the test data.
-     */
-    @Before
-    public void createTestData() {
-        testData = new CommandTestData();
-    }
-
-    /**
-     * Test {@link Command#getLayer()}
-     * @deprecated to be removed end of 2017
-     */
-    @Test
-    @Deprecated
-    public void testGetLayer() {
-        OsmDataLayer layer2 = new OsmDataLayer(new DataSet(), "test", null);
-        Command command = new NopCommand();
-        Command command2 = new NopCommand(layer2.data);
-        assertSame(testData.layer, command.getLayer());
-        assertSame(layer2, command2.getLayer());
-    }
 
     /**
@@ -75,25 +47,4 @@
             .suppress(Warning.NONFINAL_FIELDS)
             .verify();
-    }
-
-    private static final class NopCommand extends Command {
-        NopCommand() {
-            super();
-        }
-
-        NopCommand(DataSet dataset) {
-            super(dataset);
-        }
-
-        @Override
-        public String getDescriptionText() {
-            return "";
-        }
-
-        @Override
-        public void fillModifiedData(Collection<OsmPrimitive> modified, Collection<OsmPrimitive> deleted,
-                Collection<OsmPrimitive> added) {
-            // nop
-        }
     }
 
Index: trunk/test/unit/org/openstreetmap/josm/command/DeleteCommandTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/command/DeleteCommandTest.java	(revision 12719)
+++ trunk/test/unit/org/openstreetmap/josm/command/DeleteCommandTest.java	(revision 12726)
@@ -11,4 +11,5 @@
 import java.util.Collection;
 import java.util.List;
+import java.util.NoSuchElementException;
 
 import org.junit.Before;
@@ -113,9 +114,9 @@
      */
     @Test
-    public void testDelteNodesInWay() {
+    public void testDeleteNodesInWay() {
         testData.existingNode.removeAll();
         // That untagged node should be deleted.
         testData.existingNode2.removeAll();
-        DeleteCommand.delete(testData.layer, Arrays.asList(testData.existingWay), true, true).executeCommand();
+        DeleteCommand.delete(Arrays.asList(testData.existingWay), true, true).executeCommand();
 
         assertTrue(testData.existingWay.isDeleted());
@@ -137,5 +138,5 @@
         way2.setNodes(Arrays.asList(node2, node3, node4));
         testData.layer.data.addPrimitive(way2);
-        DeleteCommand.delete(testData.layer, Arrays.asList(way1, way2), true, true).executeCommand();
+        DeleteCommand.delete(Arrays.asList(way1, way2), true, true).executeCommand();
 
         assertTrue(way1.isDeleted());
@@ -167,5 +168,5 @@
      * Test that {@link DeleteCommand} checks for non-empty list
      */
-    @Test(expected = IllegalArgumentException.class)
+    @Test(expected = NoSuchElementException.class)
     public void testConsistencyNonEmpty() {
         new DeleteCommand(Arrays.<OsmPrimitive>asList());
@@ -175,5 +176,5 @@
      * Test that {@link DeleteCommand} checks for non-null list
      */
-    @Test(expected = IllegalArgumentException.class)
+    @Test(expected = NullPointerException.class)
     public void testConsistencyNonNull() {
         new DeleteCommand((Collection<OsmPrimitive>) null);
Index: trunk/test/unit/org/openstreetmap/josm/command/MoveCommandTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/command/MoveCommandTest.java	(revision 12719)
+++ trunk/test/unit/org/openstreetmap/josm/command/MoveCommandTest.java	(revision 12726)
@@ -248,5 +248,5 @@
         Node node = new Node(LatLon.ZERO);
         node.put("name", "xy");
-
+        new DataSet(node);
         List<OsmPrimitive> nodeList = Arrays.<OsmPrimitive>asList(node);
         assertTrue(new MoveCommand(nodeList, 1, 2).getDescriptionText().matches("Move 1 node"));
Index: trunk/test/unit/org/openstreetmap/josm/command/RotateCommandTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/command/RotateCommandTest.java	(revision 12719)
+++ trunk/test/unit/org/openstreetmap/josm/command/RotateCommandTest.java	(revision 12726)
@@ -55,4 +55,5 @@
         Node n2 = new Node(new EastNorth(-1, 0));
         Node n3 = new Node(new EastNorth(-9, -10));
+        new DataSet(n1, n2, n3);
         RotateCommand rotate = new RotateCommand(Arrays.asList(n1, n2, n3), new EastNorth(0, 0));
         rotate.setRotationAngle(Math.PI / 4);
@@ -73,4 +74,5 @@
         Node n2 = new Node(new EastNorth(-1, 0));
         Node n3 = new Node(new EastNorth(-9, -10));
+        new DataSet(n1, n2, n3);
         RotateCommand rotate = new RotateCommand(Arrays.asList(n1, n2, n3), new EastNorth(0, 0));
         rotate.setRotationAngle(Math.PI / 4);
Index: trunk/test/unit/org/openstreetmap/josm/command/ScaleCommandTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/command/ScaleCommandTest.java	(revision 12719)
+++ trunk/test/unit/org/openstreetmap/josm/command/ScaleCommandTest.java	(revision 12726)
@@ -55,4 +55,5 @@
         Node n2 = new Node(new EastNorth(-1, 0));
         Node n3 = new Node(new EastNorth(-9, -10));
+        new DataSet(n1, n2, n3);
         ScaleCommand scale = new ScaleCommand(Arrays.asList(n1, n2, n3), new EastNorth(0, 0));
         scale.setScalingFactor(2.5);
@@ -73,4 +74,5 @@
         Node n2 = new Node(new EastNorth(-1, 0));
         Node n3 = new Node(new EastNorth(-9, -10));
+        new DataSet(n1, n2, n3);
         ScaleCommand scale = new ScaleCommand(Arrays.asList(n1, n2, n3), new EastNorth(0, 0));
         scale.setScalingFactor(2.5);
Index: trunk/test/unit/org/openstreetmap/josm/command/SelectCommandTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/command/SelectCommandTest.java	(revision 12719)
+++ trunk/test/unit/org/openstreetmap/josm/command/SelectCommandTest.java	(revision 12726)
@@ -50,5 +50,5 @@
     @Test
     public void testExecute() {
-        SelectCommand command = new SelectCommand(Arrays.asList(testData.existingNode, testData.existingWay));
+        SelectCommand command = new SelectCommand(testData.layer.data, Arrays.asList(testData.existingNode, testData.existingWay));
 
         testData.layer.data.setSelected(Arrays.asList(testData.existingNode2));
@@ -67,5 +67,5 @@
     public void testExecuteAfterModify() {
         List<OsmPrimitive> list = new ArrayList<>(Arrays.asList(testData.existingNode, testData.existingWay));
-        SelectCommand command = new SelectCommand(list);
+        SelectCommand command = new SelectCommand(testData.layer.data, list);
 
         list.remove(testData.existingNode);
@@ -84,5 +84,5 @@
     @Test
     public void testUndo() {
-        SelectCommand command = new SelectCommand(Arrays.asList(testData.existingNode, testData.existingWay));
+        SelectCommand command = new SelectCommand(testData.layer.data, Arrays.asList(testData.existingNode, testData.existingWay));
         testData.layer.data.setSelected(Arrays.asList(testData.existingNode2));
 
@@ -110,5 +110,5 @@
         ArrayList<OsmPrimitive> deleted = new ArrayList<>();
         ArrayList<OsmPrimitive> added = new ArrayList<>();
-        SelectCommand command = new SelectCommand(Arrays.asList(testData.existingNode, testData.existingWay));
+        SelectCommand command = new SelectCommand(testData.layer.data, Arrays.asList(testData.existingNode, testData.existingWay));
         command.fillModifiedData(modified, deleted, added);
         // intentionally empty.
@@ -123,5 +123,5 @@
     @Test
     public void testGetParticipatingPrimitives() {
-        SelectCommand command = new SelectCommand(Arrays.asList(testData.existingNode));
+        SelectCommand command = new SelectCommand(testData.layer.data, Arrays.asList(testData.existingNode));
         command.executeCommand();
         assertArrayEquals(new Object[] {testData.existingNode}, command.getParticipatingPrimitives().toArray());
@@ -133,11 +133,12 @@
     @Test
     public void testDescription() {
-        assertTrue(new SelectCommand(Arrays.<OsmPrimitive>asList(testData.existingNode))
+        DataSet ds = testData.layer.data;
+        assertTrue(new SelectCommand(ds, Arrays.<OsmPrimitive>asList(testData.existingNode))
                 .getDescriptionText().matches("Selected 1 object"));
-        assertTrue(new SelectCommand(Arrays.asList(testData.existingNode, testData.existingWay))
+        assertTrue(new SelectCommand(ds, Arrays.asList(testData.existingNode, testData.existingWay))
                 .getDescriptionText().matches("Selected 2 objects"));
-        assertTrue(new SelectCommand(Arrays.<OsmPrimitive>asList())
+        assertTrue(new SelectCommand(ds, Arrays.<OsmPrimitive>asList())
                 .getDescriptionText().matches("Selected 0 objects"));
-        assertTrue(new SelectCommand(null)
+        assertTrue(new SelectCommand(ds, null)
                 .getDescriptionText().matches("Selected 0 objects"));
     }
Index: trunk/test/unit/org/openstreetmap/josm/command/SequenceCommandTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/command/SequenceCommandTest.java	(revision 12719)
+++ trunk/test/unit/org/openstreetmap/josm/command/SequenceCommandTest.java	(revision 12726)
@@ -12,4 +12,5 @@
 import java.util.Arrays;
 import java.util.Collection;
+import java.util.Collections;
 
 import org.junit.Before;
@@ -54,6 +55,7 @@
     @Test
     public void testExecute() {
-        final TestCommand command1 = new TestCommand(Arrays.<OsmPrimitive>asList(testData.existingNode));
-        TestCommand command2 = new TestCommand(Arrays.<OsmPrimitive>asList(testData.existingNode2)) {
+        DataSet ds = new DataSet();
+        final TestCommand command1 = new TestCommand(ds, Arrays.<OsmPrimitive>asList(testData.existingNode));
+        TestCommand command2 = new TestCommand(ds, Arrays.<OsmPrimitive>asList(testData.existingNode2)) {
             @Override
             public boolean executeCommand() {
@@ -75,6 +77,7 @@
     @Test
     public void testUndo() {
-        final TestCommand command2 = new TestCommand(Arrays.<OsmPrimitive>asList(testData.existingNode2));
-        TestCommand command1 = new TestCommand(Arrays.<OsmPrimitive>asList(testData.existingNode)) {
+        DataSet ds = new DataSet();
+        final TestCommand command2 = new TestCommand(ds, Arrays.<OsmPrimitive>asList(testData.existingNode2));
+        TestCommand command1 = new TestCommand(ds, Arrays.<OsmPrimitive>asList(testData.existingNode)) {
             @Override
             public void undoCommand() {
@@ -103,7 +106,8 @@
     @Test
     public void testExecuteRollback() {
-        TestCommand command1 = new TestCommand(null);
-        FailingCommand command2 = new FailingCommand();
-        TestCommand command3 = new TestCommand(null);
+        DataSet ds = new DataSet();
+        TestCommand command1 = new TestCommand(ds, null);
+        FailingCommand command2 = new FailingCommand(ds);
+        TestCommand command3 = new TestCommand(ds, null);
         SequenceCommand command = new SequenceCommand("seq", Arrays.<Command>asList(command1, command2, command3));
         assertFalse(command.executeCommand());
@@ -119,7 +123,8 @@
     @Test
     public void testContinueOnErrors() {
-        TestCommand command1 = new TestCommand(null);
-        FailingCommand command2 = new FailingCommand();
-        TestCommand command3 = new TestCommand(null);
+        DataSet ds = new DataSet();
+        TestCommand command1 = new TestCommand(ds, null);
+        FailingCommand command2 = new FailingCommand(ds);
+        TestCommand command3 = new TestCommand(ds, null);
         SequenceCommand command = new SequenceCommand("seq", Arrays.<Command>asList(command1, command2, command3), true);
         assertTrue(command.executeCommand());
@@ -137,9 +142,10 @@
     @Test
     public void testGetLastCommand() {
-        final TestCommand command1 = new TestCommand(Arrays.<OsmPrimitive>asList(testData.existingNode));
-        final TestCommand command2 = new TestCommand(Arrays.<OsmPrimitive>asList(testData.existingNode2));
-
-        assertEquals(command2, new SequenceCommand("seq", command1, command2).getLastCommand());
-        assertNull(new SequenceCommand("seq").getLastCommand());
+        DataSet ds = new DataSet();
+        final TestCommand command1 = new TestCommand(ds, Arrays.<OsmPrimitive>asList(testData.existingNode));
+        final TestCommand command2 = new TestCommand(ds, Arrays.<OsmPrimitive>asList(testData.existingNode2));
+
+        assertEquals(command2, new SequenceCommand(ds, "seq", Arrays.asList(command1, command2), false).getLastCommand());
+        assertNull(new SequenceCommand(ds, "seq", Collections.emptyList(), false).getLastCommand());
     }
 
@@ -149,7 +155,8 @@
     @Test
     public void testFillModifiedData() {
-        Command command1 = new TestCommand(Arrays.<OsmPrimitive>asList(testData.existingNode));
-        Command command2 = new TestCommand(Arrays.<OsmPrimitive>asList(testData.existingNode2));
-        Command command3 = new TestCommand(Arrays.<OsmPrimitive>asList(testData.existingWay)) {
+        DataSet ds = new DataSet();
+        Command command1 = new TestCommand(ds, Arrays.<OsmPrimitive>asList(testData.existingNode));
+        Command command2 = new TestCommand(ds, Arrays.<OsmPrimitive>asList(testData.existingNode2));
+        Command command3 = new TestCommand(ds, Arrays.<OsmPrimitive>asList(testData.existingWay)) {
             @Override
             public void fillModifiedData(Collection<OsmPrimitive> modified, Collection<OsmPrimitive> deleted,
@@ -158,5 +165,5 @@
             }
         };
-        Command command4 = new TestCommand(Arrays.<OsmPrimitive>asList(testData.existingRelation)) {
+        Command command4 = new TestCommand(ds, Arrays.<OsmPrimitive>asList(testData.existingRelation)) {
             @Override
             public void fillModifiedData(Collection<OsmPrimitive> modified, Collection<OsmPrimitive> deleted,
@@ -181,6 +188,7 @@
     @Test
     public void testGetParticipatingPrimitives() {
-        Command command1 = new TestCommand(Arrays.<OsmPrimitive>asList(testData.existingNode));
-        Command command2 = new TestCommand(Arrays.<OsmPrimitive>asList(testData.existingNode2));
+        DataSet ds = new DataSet();
+        Command command1 = new TestCommand(ds, Arrays.<OsmPrimitive>asList(testData.existingNode));
+        Command command2 = new TestCommand(ds, Arrays.<OsmPrimitive>asList(testData.existingNode2));
 
         SequenceCommand command = new SequenceCommand("seq", command1, command2);
@@ -197,5 +205,5 @@
     @Test
     public void testDescription() {
-        assertTrue(new SequenceCommand("test").getDescriptionText().matches("Sequence: test"));
+        assertTrue(new SequenceCommand(new DataSet(), "test", Collections.emptyList(), false).getDescriptionText().matches("Sequence: test"));
     }
 
@@ -205,7 +213,8 @@
     @Test
     public void testEqualsContract() {
+        DataSet ds = new DataSet();
         EqualsVerifier.forClass(SequenceCommand.class).usingGetClass()
             .withPrefabValues(Command.class,
-                new AddCommand(new Node(1)), new AddCommand(new Node(2)))
+                new AddCommand(ds, new Node(1)), new AddCommand(ds, new Node(2)))
             .withPrefabValues(DataSet.class,
                     new DataSet(), new DataSet())
@@ -222,6 +231,6 @@
         protected boolean executed;
 
-        TestCommand(Collection<? extends OsmPrimitive> primitives) {
-            super();
+        TestCommand(DataSet ds, Collection<? extends OsmPrimitive> primitives) {
+            super(ds);
             this.primitives = primitives;
         }
@@ -266,6 +275,6 @@
     private static class FailingCommand extends TestCommand {
 
-        FailingCommand() {
-            super(null);
+        FailingCommand(DataSet ds) {
+            super(ds, null);
         }
 
@@ -286,6 +295,4 @@
             return "FailingCommand";
         }
-
-    }
-
+    }
 }
Index: trunk/test/unit/org/openstreetmap/josm/command/conflict/ConflictAddCommandTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/command/conflict/ConflictAddCommandTest.java	(revision 12719)
+++ trunk/test/unit/org/openstreetmap/josm/command/conflict/ConflictAddCommandTest.java	(revision 12726)
@@ -6,8 +6,8 @@
 import static org.junit.Assert.assertTrue;
 
-import org.junit.After;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
+import org.openstreetmap.josm.command.CommandTest.CommandTestData;
 import org.openstreetmap.josm.data.conflict.Conflict;
 import org.openstreetmap.josm.data.osm.DataSet;
@@ -15,5 +15,4 @@
 import org.openstreetmap.josm.data.osm.User;
 import org.openstreetmap.josm.data.osm.Way;
-import org.openstreetmap.josm.gui.MainApplication;
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
 import org.openstreetmap.josm.testutils.JOSMTestRules;
@@ -28,6 +27,4 @@
 public class ConflictAddCommandTest {
 
-    private OsmDataLayer layer;
-
     /**
      * Setup test.
@@ -36,4 +33,5 @@
     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
     public JOSMTestRules test = new JOSMTestRules().platform();
+    private CommandTestData testData;
 
     /**
@@ -42,14 +40,5 @@
     @Before
     public void setUp() {
-        layer = new OsmDataLayer(new DataSet(), null, null);
-        MainApplication.getLayerManager().addLayer(layer);
-    }
-
-    /**
-     * Cleanup test resources.
-     */
-    @After
-    public void tearDown() {
-        MainApplication.getLayerManager().removeLayer(layer);
+        testData = new CommandTestData();
     }
 
@@ -59,6 +48,6 @@
     @Test
     public void testExecuteUndoCommand() {
-        DataSet ds = MainApplication.getLayerManager().getEditDataSet();
-        Conflict<Node> conflict = new Conflict<>(new Node(), new Node());
+        DataSet ds = testData.layer.data;
+        Conflict<Node> conflict = new Conflict<>(testData.existingNode, testData.existingNode2);
         ConflictAddCommand cmd = new ConflictAddCommand(ds, conflict);
         assertTrue(cmd.executeCommand());
@@ -75,7 +64,6 @@
     @Test
     public void testGetDescriptionIcon() {
-        OsmDataLayer layer = MainApplication.getLayerManager().getEditLayer();
-        Conflict<Node> conflict = new Conflict<>(new Node(), new Node());
-        assertNotNull(new ConflictAddCommand(layer, conflict).getDescriptionIcon());
+        Conflict<Node> conflict = new Conflict<>(testData.existingNode, testData.existingNode2);
+        assertNotNull(new ConflictAddCommand(testData.layer.data, conflict).getDescriptionIcon());
     }
 
Index: trunk/test/unit/org/openstreetmap/josm/command/conflict/CoordinateConflictResolveCommandTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/command/conflict/CoordinateConflictResolveCommandTest.java	(revision 12719)
+++ trunk/test/unit/org/openstreetmap/josm/command/conflict/CoordinateConflictResolveCommandTest.java	(revision 12726)
@@ -6,8 +6,8 @@
 import static org.junit.Assert.assertTrue;
 
-import org.junit.After;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
+import org.openstreetmap.josm.command.CommandTest.CommandTestData;
 import org.openstreetmap.josm.data.conflict.Conflict;
 import org.openstreetmap.josm.data.coor.LatLon;
@@ -16,5 +16,4 @@
 import org.openstreetmap.josm.data.osm.User;
 import org.openstreetmap.josm.data.osm.Way;
-import org.openstreetmap.josm.gui.MainApplication;
 import org.openstreetmap.josm.gui.conflict.pair.MergeDecisionType;
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
@@ -30,5 +29,5 @@
 public class CoordinateConflictResolveCommandTest {
 
-    private OsmDataLayer layer;
+    private CommandTestData testData;
 
     /**
@@ -44,18 +43,9 @@
     @Before
     public void setUp() {
-        layer = new OsmDataLayer(new DataSet(), null, null);
-        MainApplication.getLayerManager().addLayer(layer);
+        testData = new CommandTestData();
     }
 
-    /**
-     * Cleanup test resources.
-     */
-    @After
-    public void tearDown() {
-        MainApplication.getLayerManager().removeLayer(layer);
-    }
-
-    private static Conflict<Node> createConflict() {
-        return new Conflict<>(new Node(LatLon.ZERO), new Node(new LatLon(50, 50)));
+    private Conflict<Node> createConflict() {
+        return new Conflict<>(testData.existingNode, testData.existingNode2);
     }
 
Index: trunk/test/unit/org/openstreetmap/josm/data/validation/tests/MapCSSTagCheckerTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/data/validation/tests/MapCSSTagCheckerTest.java	(revision 12719)
+++ trunk/test/unit/org/openstreetmap/josm/data/validation/tests/MapCSSTagCheckerTest.java	(revision 12726)
@@ -25,5 +25,5 @@
 import org.openstreetmap.josm.command.PseudoCommand;
 import org.openstreetmap.josm.command.SequenceCommand;
-import org.openstreetmap.josm.data.osm.Node;
+import org.openstreetmap.josm.data.osm.DataSet;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
 import org.openstreetmap.josm.data.osm.OsmUtils;
@@ -82,6 +82,7 @@
         assertEquals("fixAdd: natural=wetland", check.fixCommands.get(1).toString());
         assertEquals("fixAdd: wetland=marsh", check.fixCommands.get(2).toString());
-        final Node n1 = new Node();
-        n1.put("natural", "marsh");
+        final OsmPrimitive n1 = OsmUtils.createPrimitive("node natural=marsh");
+        final OsmPrimitive n2 = OsmUtils.createPrimitive("node natural=wood");
+        new DataSet(n1, n2);
         assertTrue(check.test(n1));
         assertEquals("deprecated", check.getErrorForPrimitive(n1).getMessage());
@@ -90,6 +91,4 @@
         assertEquals("Sequence: Fix of natural=marsh is deprecated", check.fixPrimitive(n1).getDescriptionText());
         assertEquals("{natural=}", ((ChangePropertyCommand) check.fixPrimitive(n1).getChildren().iterator().next()).getTags().toString());
-        final Node n2 = new Node();
-        n2.put("natural", "wood");
         assertFalse(check.test(n2));
         assertEquals("The key is natural and the value is marsh",
@@ -109,4 +108,5 @@
                 "fixAdd: \"highway=construction\";\n" +
                 "}")).parseChecks.get(0);
+        new DataSet(p);
         final Command command = check.fixPrimitive(p);
         assertTrue(command instanceof SequenceCommand);
Index: trunk/test/unit/org/openstreetmap/josm/gui/conflict/pair/ConflictResolverTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/gui/conflict/pair/ConflictResolverTest.java	(revision 12719)
+++ trunk/test/unit/org/openstreetmap/josm/gui/conflict/pair/ConflictResolverTest.java	(revision 12726)
@@ -5,4 +5,6 @@
 import static org.junit.Assert.assertNotNull;
 
+import java.util.NoSuchElementException;
+
 import org.junit.Rule;
 import org.junit.Test;
@@ -10,4 +12,5 @@
 import org.openstreetmap.josm.data.conflict.Conflict;
 import org.openstreetmap.josm.data.coor.LatLon;
+import org.openstreetmap.josm.data.osm.DataSet;
 import org.openstreetmap.josm.data.osm.Node;
 import org.openstreetmap.josm.data.osm.Relation;
@@ -32,5 +35,5 @@
      * Unit test of {@link ConflictResolver#buildResolveCommand} - empty case.
      */
-    @Test
+    @Test(expected = NoSuchElementException.class)
     public void testBuildResolveCommandEmpty() {
         assertNotNull(new ConflictResolver().buildResolveCommand());
@@ -47,4 +50,5 @@
         Node n2 = new Node(LatLon.NORTH_POLE);
         n2.put("source", "theirs");
+        new DataSet(n1, n2);
         resolver.populate(new Conflict<>(n1, n2));
         resolver.decideRemaining(MergeDecisionType.KEEP_MINE);
@@ -62,4 +66,5 @@
         Way w2 = new Way();
         w2.put("source", "theirs");
+        new DataSet(w1, w2);
         resolver.populate(new Conflict<>(w1, w2));
         resolver.decideRemaining(MergeDecisionType.KEEP_MINE);
@@ -77,4 +82,5 @@
         Relation r2 = new Relation();
         r2.put("source", "theirs");
+        new DataSet(r1, r2);
         resolver.populate(new Conflict<>(r1, r2));
         resolver.decideRemaining(MergeDecisionType.KEEP_MINE);
Index: trunk/test/unit/org/openstreetmap/josm/gui/datatransfer/OsmTransferHandlerTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/gui/datatransfer/OsmTransferHandlerTest.java	(revision 12719)
+++ trunk/test/unit/org/openstreetmap/josm/gui/datatransfer/OsmTransferHandlerTest.java	(revision 12726)
@@ -64,4 +64,5 @@
     public void testPasteTags() {
         Node n = new Node(LatLon.ZERO);
+        new DataSet(n);
 
         ClipboardUtils.copyString("test=ok");
Index: trunk/test/unit/org/openstreetmap/josm/gui/dialogs/CommandStackDialogTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/gui/dialogs/CommandStackDialogTest.java	(revision 12719)
+++ trunk/test/unit/org/openstreetmap/josm/gui/dialogs/CommandStackDialogTest.java	(revision 12726)
@@ -46,9 +46,10 @@
     @Test
     public void testCommandStackDialogNotEmpty() {
-        OsmDataLayer layer = new OsmDataLayer(new DataSet(), "", null);
+        DataSet ds = new DataSet();
+        OsmDataLayer layer = new OsmDataLayer(ds, "", null);
         MainApplication.getLayerManager().addLayer(layer);
         try {
-            Command cmd1 = TestUtils.newCommand();
-            Command cmd2 = TestUtils.newCommand();
+            Command cmd1 = TestUtils.newCommand(ds);
+            Command cmd2 = TestUtils.newCommand(ds);
             MainApplication.undoRedo.add(cmd1);
             MainApplication.undoRedo.add(cmd2);
