Index: trunk/src/org/openstreetmap/josm/data/osm/OsmUtils.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/OsmUtils.java	(revision 7353)
+++ trunk/src/org/openstreetmap/josm/data/osm/OsmUtils.java	(revision 7356)
@@ -6,4 +6,8 @@
 import java.util.List;
 import java.util.Locale;
+import java.util.Map;
+
+import org.openstreetmap.josm.tools.CheckParameterUtil;
+import org.openstreetmap.josm.tools.TextTagParser;
 
 public final class OsmUtils {
@@ -48,3 +52,30 @@
         return FALSE_VALUES.contains(value);
     }
+
+    /**
+     * Creates a new OSM primitive 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.
+     * @param assertion The assertion describing OSM primitive (ex: "way name=Foo railway=rail")
+     * @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 7356
+     */
+    public static OsmPrimitive createPrimitive(String assertion) {
+        CheckParameterUtil.ensureParameterNotNull(assertion, "assertion");
+        final String[] x = assertion.split("\\s+", 2);
+        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 (final Map.Entry<String, String> i : TextTagParser.readTagsFromText(x[1]).entrySet()) {
+            p.put(i.getKey(), i.getValue());
+        }
+        return p;
+    }
 }
Index: trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java	(revision 7353)
+++ trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java	(revision 7356)
@@ -8,4 +8,5 @@
 import java.io.InputStream;
 import java.io.Reader;
+import java.text.MessageFormat;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -15,4 +16,5 @@
 import java.util.Iterator;
 import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
 import java.util.LinkedList;
 import java.util.List;
@@ -28,4 +30,5 @@
 import org.openstreetmap.josm.command.SequenceCommand;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
+import org.openstreetmap.josm.data.osm.OsmUtils;
 import org.openstreetmap.josm.data.osm.Tag;
 import org.openstreetmap.josm.data.validation.FixableTestError;
@@ -340,5 +343,7 @@
                 }
             } catch (IndexOutOfBoundsException ignore) {
-                Main.debug(ignore.getMessage());
+                if (Main.isDebugEnabled()) {
+                    Main.debug(ignore.getMessage());
+                }
             }
             return null;
@@ -557,4 +562,10 @@
             checks.remove(url);
             checks.putAll(url, tagchecks);
+            // Check assertions, useful for development of local files
+            if (Main.pref.getBoolean("validator.check_assert_local_rules", false) && Utils.isLocalUrl(url)) {
+                for (String msg : checkAsserts(tagchecks)) {
+                    Main.warn(msg);
+                }
+            }
         }
     }
@@ -569,8 +580,8 @@
             String i = source.url;
             try {
-                if (i.startsWith("resource:")) {
+                if (!i.startsWith("resource:")) {
+                    Main.info(tr("Adding {0} to tag checker", i));
+                } else if (Main.isDebugEnabled()) {
                     Main.debug(tr("Adding {0} to tag checker", i));
-                } else {
-                    Main.info(tr("Adding {0} to tag checker", i));
                 }
                 addMapCSS(i);
@@ -590,4 +601,38 @@
             }
         }
+    }
+
+    /**
+     * Checks that rule assertions are met for the given set of TagChecks.
+     * @param schecks The TagChecks for which assertions have to be checked
+     * @return A set of error messages, empty if all assertions are met
+     * @since 7356
+     */
+    public Set<String> checkAsserts(final Collection<TagCheck> schecks) {
+        Set<String> assertionErrors = new LinkedHashSet<>();
+        for (final TagCheck check : schecks) {
+            if (Main.isDebugEnabled()) {
+                Main.debug("Check: "+check);
+            }
+            for (final Map.Entry<String, Boolean> i : check.assertions.entrySet()) {
+                if (Main.isDebugEnabled()) {
+                    Main.debug("- Assertion: "+i);
+                }
+                final OsmPrimitive p = OsmUtils.createPrimitive(i.getKey());
+                final boolean isError = Utils.exists(getErrorsForPrimitive(p, true), new Predicate<TestError>() {
+                    @Override
+                    public boolean evaluate(TestError e) {
+                        //noinspection EqualsBetweenInconvertibleTypes
+                        return e.getTester().equals(check.rule);
+                    }
+                });
+                if (isError != i.getValue()) {
+                    final String error = MessageFormat.format("Expecting test ''{0}'' (i.e., {1}) to {2} {3} (i.e., {4})",
+                            check.getMessage(p), check.rule.selectors, i.getValue() ? "match" : "not match", i.getKey(), p.getKeys());
+                    assertionErrors.add(error);
+                }
+            }
+        }
+        return assertionErrors;
     }
 
Index: trunk/src/org/openstreetmap/josm/gui/preferences/SourceEntry.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/preferences/SourceEntry.java	(revision 7353)
+++ trunk/src/org/openstreetmap/josm/gui/preferences/SourceEntry.java	(revision 7356)
@@ -8,4 +8,5 @@
 
 import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.tools.Utils;
 
 /**
@@ -178,7 +179,5 @@
      */
     public boolean isLocal() {
-        if (url.startsWith("http://") || url.startsWith("https://") || url.startsWith("resource://"))
-            return false;
-        return true;
+        return Utils.isLocalUrl(url);
     }
 
Index: trunk/src/org/openstreetmap/josm/tools/Utils.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/Utils.java	(revision 7353)
+++ trunk/src/org/openstreetmap/josm/tools/Utils.java	(revision 7356)
@@ -1053,3 +1053,14 @@
     }
 
+    /**
+     * Determines if the given URL denotes a file on a local filesystem.
+     * @param url The URL to test
+     * @return {@code true} if the url points to a local file
+     * @since 7356
+     */
+    public static boolean isLocalUrl(String url) {
+        if (url.startsWith("http://") || url.startsWith("https://") || url.startsWith("resource://"))
+            return false;
+        return true;
+    }
 }
