Index: trunk/src/org/openstreetmap/josm/data/osm/OsmUtils.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/OsmUtils.java	(revision 14484)
+++ trunk/src/org/openstreetmap/josm/data/osm/OsmUtils.java	(revision 14486)
@@ -115,4 +115,5 @@
      * Creates a new OSM primitive around (0,0) according to the given assertion. Originally written for unit tests,
      * this can also be used in another places like validation of local MapCSS validator rules.
+     * Ways and relations created using this method are empty.
      * @param assertion The assertion describing OSM primitive (ex: "way name=Foo railway=rail")
      * @return a new OSM primitive according to the given assertion
@@ -121,5 +122,5 @@
      */
     public static OsmPrimitive createPrimitive(String assertion) {
-        return createPrimitive(assertion, LatLon.ZERO);
+        return createPrimitive(assertion, LatLon.ZERO, false);
     }
 
@@ -129,17 +130,18 @@
      * @param assertion The assertion describing OSM primitive (ex: "way name=Foo railway=rail")
      * @param around the coordinate at which the primitive will be located
+     * @param enforceLocation if {@code true}, ways and relations will not be empty to force a physical location
      * @return a new OSM primitive according to the given assertion
      * @throws IllegalArgumentException if assertion is null or if the primitive type cannot be deduced from it
-     * @since 14484
-     */
-    public static OsmPrimitive createPrimitive(String assertion, LatLon around) {
+     * @since 14486
+     */
+    public static OsmPrimitive createPrimitive(String assertion, LatLon around, boolean enforceLocation) {
         CheckParameterUtil.ensureParameterNotNull(assertion, "assertion");
         final String[] x = assertion.split("\\s+", 2);
         final OsmPrimitive p = "n".equals(x[0]) || "node".equals(x[0])
-                ? new Node(around)
+                ? newNode(around)
                 : "w".equals(x[0]) || "way".equals(x[0]) || /*for MapCSS related usage*/ "area".equals(x[0])
-                ? newWay(around)
+                ? newWay(around, enforceLocation)
                 : "r".equals(x[0]) || "relation".equals(x[0])
-                ? newRelation(around)
+                ? newRelation(around, enforceLocation)
                 : null;
         if (p == null) {
@@ -158,14 +160,18 @@
     }
 
-    private static Way newWay(LatLon around) {
+    private static Way newWay(LatLon around, boolean enforceLocation) {
         Way w = new Way();
-        w.addNode(newNode(new LatLon(around.lat()+0.1, around.lon())));
-        w.addNode(newNode(new LatLon(around.lat()-0.1, around.lon())));
+        if (enforceLocation) {
+            w.addNode(newNode(new LatLon(around.lat()+0.1, around.lon())));
+            w.addNode(newNode(new LatLon(around.lat()-0.1, around.lon())));
+        }
         return w;
     }
 
-    private static Relation newRelation(LatLon around) {
+    private static Relation newRelation(LatLon around, boolean enforceLocation) {
         Relation r = new Relation();
-        r.addMember(new RelationMember(null, newNode(around)));
+        if (enforceLocation) {
+            r.addMember(new RelationMember(null, newNode(around)));
+        }
         return r;
     }
Index: trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java	(revision 14484)
+++ trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java	(revision 14486)
@@ -44,5 +44,7 @@
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
 import org.openstreetmap.josm.data.osm.OsmUtils;
+import org.openstreetmap.josm.data.osm.Relation;
 import org.openstreetmap.josm.data.osm.Tag;
+import org.openstreetmap.josm.data.osm.Way;
 import org.openstreetmap.josm.data.preferences.sources.SourceEntry;
 import org.openstreetmap.josm.data.preferences.sources.ValidatorPrefHelper;
@@ -1024,5 +1026,5 @@
             for (final Map.Entry<String, Boolean> i : check.assertions.entrySet()) {
                 Logging.debug("- Assertion: {0}", i);
-                final OsmPrimitive p = OsmUtils.createPrimitive(i.getKey(), getLocation(check, insideMethod));
+                final OsmPrimitive p = OsmUtils.createPrimitive(i.getKey(), getLocation(check, insideMethod), true);
                 // Build minimal ordered list of checks to run to test the assertion
                 List<Set<TagCheck>> checksToRun = new ArrayList<>();
@@ -1033,5 +1035,5 @@
                 checksToRun.add(Collections.singleton(check));
                 // Add primitive to dataset to avoid DataIntegrityProblemException when evaluating selectors
-                ds.addPrimitive(p);
+                addPrimitive(ds, p);
                 final Collection<TestError> pErrors = getErrorsForPrimitive(p, true, checksToRun);
                 Logging.debug("- Errors: {0}", pErrors);
@@ -1047,4 +1049,13 @@
         }
         return assertionErrors;
+    }
+
+    private static void addPrimitive(DataSet ds, OsmPrimitive p) {
+        if (p instanceof Way) {
+            ((Way) p).getNodes().forEach(n -> addPrimitive(ds, n));
+        } else if (p instanceof Relation) {
+            ((Relation) p).getMembers().forEach(m -> addPrimitive(ds, m.getMember()));
+        }
+        ds.addPrimitive(p);
     }
 
