Index: trunk/data/validator/deprecated.mapcss
===================================================================
--- trunk/data/validator/deprecated.mapcss	(revision 6511)
+++ trunk/data/validator/deprecated.mapcss	(revision 6512)
@@ -4,4 +4,6 @@
   fixAdd: "barrier=fence";
   fixAdd: "fence_type=chain_link";
+  assertMatch: "way barrier=wire_fence";
+  assertNoMatch: "way barrier=fence";
 }
   
Index: trunk/src/org/openstreetmap/josm/data/osm/Tag.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/Tag.java	(revision 6511)
+++ trunk/src/org/openstreetmap/josm/data/osm/Tag.java	(revision 6512)
@@ -105,5 +105,5 @@
             return new Tag(x[0], x[1]);
         } else {
-            throw new IllegalArgumentException("String does not contain '='");
+            throw new IllegalArgumentException("'" + s + "' does not contain '='");
         }
     }
Index: trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java	(revision 6511)
+++ trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java	(revision 6512)
@@ -53,4 +53,5 @@
         protected final List<Tag> alternatives = new ArrayList<Tag>();
         protected final Map<String, Severity> errors = new HashMap<String, Severity>();
+        protected final Map<String, Boolean> assertions = new HashMap<String, Boolean>();
 
         TagCheck(List<Selector> selector) {
@@ -82,4 +83,8 @@
                     } else if ("suggestAlternative".equals(ai.key) && val != null) {
                         check.alternatives.add(val.contains("=") ? Tag.ofString(val) : new Tag(val));
+                    } else if ("assertMatch".equals(ai.key) && val != null) {
+                        check.assertions.put(val, true);
+                    } else if ("assertNoMatch".equals(ai.key) && val != null) {
+                        check.assertions.put(val, false);
                     } else {
                         throw new RuntimeException("Cannot add instruction " + ai.key + ": " + ai.val + "!");
Index: trunk/test/unit/org/openstreetmap/josm/data/validation/tests/MapCSSTagCheckerTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/data/validation/tests/MapCSSTagCheckerTest.java	(revision 6511)
+++ trunk/test/unit/org/openstreetmap/josm/data/validation/tests/MapCSSTagCheckerTest.java	(revision 6512)
@@ -6,8 +6,13 @@
 import org.openstreetmap.josm.data.Preferences;
 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.Tag;
+import org.openstreetmap.josm.data.osm.Way;
 
 import java.io.StringReader;
+import java.util.LinkedHashSet;
 import java.util.List;
+import java.util.Map;
 
 import static org.hamcrest.CoreMatchers.is;
@@ -49,8 +54,54 @@
     }
 
+    OsmPrimitive createPrimitiveForAssertion(String assertion) {
+        final String[] x = assertion.split("\\s+");
+        final OsmPrimitive p = "n".equals(x[0]) || "node".equals(x[0])
+                ? new Node()
+                : "w".equals(x[0]) || "way".equals(x[0])
+                ? new Way()
+                : "r".equals(x[0]) || "relation".equals(x[0])
+                ? new Relation()
+                : null;
+        if (p == null) {
+            throw new IllegalArgumentException("Expecting n/node/w/way/r/relation, but got " + x[0]);
+        }
+        for (int i = 1; i < x.length; i++) {
+            final Tag tag = Tag.ofString(x[i]);
+            p.put(tag.getKey(), tag.getValue());
+        }
+        return p;
+    }
+
+    @Test
+    public void testCreatePrimitiveForAssertion() throws Exception {
+        final OsmPrimitive p = createPrimitiveForAssertion("way name=Foo railway=rail");
+        assertTrue(p instanceof Way);
+        assertThat(p.keySet().size(), is(2));
+        assertThat(p.get("name"), is("Foo"));
+        assertThat(p.get("railway"), is("rail"));
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testCreatePrimitiveForAssertionFail() throws Exception {
+        final OsmPrimitive p = createPrimitiveForAssertion("noway name=Foo");
+    }
+
     @Test
     public void testInit() throws Exception {
         final MapCSSTagChecker c = new MapCSSTagChecker();
         c.initialize();
+
+        LinkedHashSet<String> assertionErrors = new LinkedHashSet<String>();
+        for (final MapCSSTagChecker.TagCheck check : c.checks) {
+            for (final Map.Entry<String, Boolean> i : check.assertions.entrySet()) {
+                if (check.matchesPrimitive(createPrimitiveForAssertion(i.getKey())) != i.getValue()) {
+                    final String error = "Expecting test '" + check.getMessage() + "' to " + (i.getValue() ? "" : "not ") + "match " + i.getKey();
+                    System.err.println(error);
+                    assertionErrors.add(error);
+                }
+            }
+        }
+        assertTrue("not all assertions included in the tests are met", assertionErrors.isEmpty());
+
     }
 }
