Index: trunk/src/org/openstreetmap/josm/data/osm/OsmUtils.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/OsmUtils.java	(revision 7355)
+++ 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 7355)
+++ 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 7355)
+++ 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 7355)
+++ 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;
+    }
 }
Index: trunk/test/unit/org/openstreetmap/josm/TestUtils.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/TestUtils.java	(revision 7355)
+++ trunk/test/unit/org/openstreetmap/josm/TestUtils.java	(revision 7356)
@@ -9,13 +9,13 @@
 import java.util.Arrays;
 import java.util.Comparator;
-import java.util.Map;
 
 import org.junit.Test;
-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.OsmUtils;
 import org.openstreetmap.josm.data.osm.Way;
-import org.openstreetmap.josm.tools.TextTagParser;
 
+/**
+ * Various utils, useful for unit tests.
+ */
 public class TestUtils {
 
@@ -32,28 +32,7 @@
     }
 
-    public static OsmPrimitive createPrimitive(String assertion) {
-        if (Main.pref == null) {
-            Main.initApplicationPreferences();
-        }
-        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;
-    }
-
     @Test
     public void testCreatePrimitive() throws Exception {
-        final OsmPrimitive p = createPrimitive("way name=Foo railway=rail");
+        final OsmPrimitive p = OsmUtils.createPrimitive("way name=Foo railway=rail");
         assertTrue(p instanceof Way);
         assertThat(p.keySet().size(), is(2));
@@ -64,5 +43,5 @@
     @Test(expected = IllegalArgumentException.class)
     public void testCreatePrimitiveFail() throws Exception {
-        TestUtils.createPrimitive("noway name=Foo");
+        OsmUtils.createPrimitive("noway name=Foo");
     }
 
Index: trunk/test/unit/org/openstreetmap/josm/data/validation/tests/MapCSSTagCheckerTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/data/validation/tests/MapCSSTagCheckerTest.java	(revision 7355)
+++ trunk/test/unit/org/openstreetmap/josm/data/validation/tests/MapCSSTagCheckerTest.java	(revision 7356)
@@ -8,8 +8,6 @@
 
 import java.io.StringReader;
-import java.text.MessageFormat;
 import java.util.LinkedHashSet;
 import java.util.List;
-import java.util.Map;
 import java.util.Set;
 
@@ -17,15 +15,14 @@
 import org.junit.Test;
 import org.openstreetmap.josm.JOSMFixture;
-import org.openstreetmap.josm.TestUtils;
+import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.command.ChangePropertyCommand;
 import org.openstreetmap.josm.data.osm.Node;
-import org.openstreetmap.josm.data.osm.OsmPrimitive;
 import org.openstreetmap.josm.data.osm.Tag;
 import org.openstreetmap.josm.data.validation.Severity;
-import org.openstreetmap.josm.data.validation.TestError;
 import org.openstreetmap.josm.data.validation.tests.MapCSSTagChecker.TagCheck;
-import org.openstreetmap.josm.tools.Predicate;
-import org.openstreetmap.josm.tools.Utils;
 
+/**
+ * JUnit Test of MapCSS TagChecker.
+ */
 public class MapCSSTagCheckerTest {
 
@@ -72,29 +69,13 @@
     @Test
     public void testInit() throws Exception {
-        final MapCSSTagChecker c = new MapCSSTagChecker();
+        MapCSSTagChecker c = new MapCSSTagChecker();
         c.initialize();
 
-        LinkedHashSet<String> assertionErrors = new LinkedHashSet<>();
-        for (final Set<TagCheck> schecks : c.checks.values()) {
-            for (final TagCheck check : schecks) {
-                System.out.println("Check: "+check);
-                for (final Map.Entry<String, Boolean> i : check.assertions.entrySet()) {
-                    System.out.println("- Assertion: "+i);
-                    final OsmPrimitive p = TestUtils.createPrimitive(i.getKey());
-                    final boolean isError = Utils.exists(c.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());
-                        System.err.println(error);
-                        assertionErrors.add(error);
-                    }
-                }
-            }
+        Set<String> assertionErrors = new LinkedHashSet<>();
+        for (Set<TagCheck> schecks : c.checks.values()) {
+            assertionErrors.addAll(c.checkAsserts(schecks));
+        }
+        for (String msg : assertionErrors) {
+            Main.error(msg);
         }
         assertTrue("not all assertions included in the tests are met", assertionErrors.isEmpty());
Index: trunk/test/unit/org/openstreetmap/josm/gui/DefaultNameFormatterTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/gui/DefaultNameFormatterTest.java	(revision 7355)
+++ trunk/test/unit/org/openstreetmap/josm/gui/DefaultNameFormatterTest.java	(revision 7356)
@@ -18,4 +18,5 @@
 import org.openstreetmap.josm.data.osm.DataSet;
 import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
+import org.openstreetmap.josm.data.osm.OsmUtils;
 import org.openstreetmap.josm.data.osm.Relation;
 import org.openstreetmap.josm.data.osm.Way;
@@ -106,10 +107,10 @@
 
     static String getFormattedRelationName(String tagsString) {
-        return DefaultNameFormatter.getInstance().format((Relation) TestUtils.createPrimitive("relation " + tagsString))
+        return DefaultNameFormatter.getInstance().format((Relation) OsmUtils.createPrimitive("relation " + tagsString))
                 .replace("\u200E", "").replace("\u200F", "");
     }
 
     static String getFormattedWayName(String tagsString) {
-        return DefaultNameFormatter.getInstance().format((Way) TestUtils.createPrimitive("way " + tagsString))
+        return DefaultNameFormatter.getInstance().format((Way) OsmUtils.createPrimitive("way " + tagsString))
                 .replace("\u200E", "").replace("\u200F", "");
     }
Index: trunk/test/unit/org/openstreetmap/josm/gui/tagging/PresetClassificationsTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/gui/tagging/PresetClassificationsTest.java	(revision 7355)
+++ trunk/test/unit/org/openstreetmap/josm/gui/tagging/PresetClassificationsTest.java	(revision 7356)
@@ -2,13 +2,5 @@
 package org.openstreetmap.josm.gui.tagging;
 
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.openstreetmap.josm.JOSMFixture;
-import org.openstreetmap.josm.TestUtils;
-import org.openstreetmap.josm.data.osm.Node;
-import org.openstreetmap.josm.data.osm.OsmPrimitive;
-import org.openstreetmap.josm.data.osm.Way;
-import org.openstreetmap.josm.tools.Utils;
-import org.xml.sax.SAXException;
+import static org.junit.Assert.assertTrue;
 
 import java.io.IOException;
@@ -18,5 +10,13 @@
 import java.util.List;
 
-import static org.junit.Assert.assertTrue;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.openstreetmap.josm.JOSMFixture;
+import org.openstreetmap.josm.data.osm.Node;
+import org.openstreetmap.josm.data.osm.OsmPrimitive;
+import org.openstreetmap.josm.data.osm.OsmUtils;
+import org.openstreetmap.josm.data.osm.Way;
+import org.openstreetmap.josm.tools.Utils;
+import org.xml.sax.SAXException;
 
 public class PresetClassificationsTest {
@@ -61,9 +61,8 @@
     @Test
     public void testRelationsForTram() {
-        final OsmPrimitive tram = TestUtils.createPrimitive("way railway=tram");
+        final OsmPrimitive tram = OsmUtils.createPrimitive("way railway=tram");
         assertTrue("railway=tram should match 'Railway route' for relation creation", getMatchingPresetNames("route", tram).contains("Railway route"));
         assertTrue("railway=tram should match 'Public transport route' for relation creation", getMatchingPresetNames("route", tram).contains("Public transport route"));
         assertTrue("railway=tram should not match 'Bus route'", !getMatchingPresetNames("route", tram).contains("Bus route"));
     }
-
 }
