Index: trunk/test/unit/org/openstreetmap/josm/TestUtils.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/TestUtils.java	(revision 7337)
+++ 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 7337)
+++ 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 7337)
+++ 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 7337)
+++ 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"));
     }
-
 }
