Index: trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java	(revision 7108)
+++ trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java	(revision 7109)
@@ -25,5 +25,4 @@
 import java.awt.geom.Point2D;
 import java.awt.geom.Rectangle2D;
-import java.util.AbstractList;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -71,4 +70,5 @@
 import org.openstreetmap.josm.gui.mappaint.StyleCache.StyleList;
 import org.openstreetmap.josm.gui.mappaint.TextElement;
+import org.openstreetmap.josm.tools.CompositeList;
 import org.openstreetmap.josm.tools.ImageProvider;
 import org.openstreetmap.josm.tools.Utils;
@@ -237,34 +237,4 @@
 
             return Float.compare(this.style.object_z_index, other.style.object_z_index);
-        }
-    }
-
-    /**
-     * Joined List build from two Lists (read-only).
-     *
-     * Extremely simple single-purpose implementation.
-     * @param <T>
-     */
-    public static class CompositeList<T> extends AbstractList<T> {
-        List<? extends T> a,b;
-
-        /**
-         * Constructs a new {@code CompositeList} from two lists.
-         * @param a First list
-         * @param b Second list
-         */
-        public CompositeList(List<? extends T> a, List<? extends T> b) {
-            this.a = a;
-            this.b = b;
-        }
-
-        @Override
-        public T get(int index) {
-            return index < a.size() ? a.get(index) : b.get(index - a.size());
-        }
-
-        @Override
-        public int size() {
-            return a.size() + b.size();
         }
     }
@@ -1360,8 +1330,10 @@
 
         /**
-         * Constructor for CreateStyleRecordsWorker.
+         * Constructs a new {@code ComputeStyleListWorker}.
          * @param input the primitives to process
          * @param from first index of <code>input</code> to use
          * @param to last index + 1
+         * @param output the list of styles to which styles will be added
+         * @param data the data set
          */
         public ComputeStyleListWorker(final List<? extends OsmPrimitive> input, int from, int to, List<StyleRecord> output, DataSet data) {
@@ -1516,7 +1488,7 @@
             List<Way> ways = data.searchWays(bbox);
             List<Relation> relations = data.searchRelations(bbox);
-
+    
             final List<StyleRecord> allStyleElems = new ArrayList<>(nodes.size()+ways.size()+relations.size());
-
+    
             ConcurrentTasksHelper helper = new ConcurrentTasksHelper(allStyleElems, data);
 
@@ -1545,10 +1517,10 @@
                 );
             }
-
+    
             if (Main.isTraceEnabled()) {
                 timeFinished = System.currentTimeMillis();
                 System.err.println("; phase 2 (draw): " + (timeFinished - timePhase1) + " ms; total: " + (timeFinished - timeStart) + " ms");
             }
-
+    
             drawVirtualNodes(data, bbox);
         } finally {
Index: trunk/src/org/openstreetmap/josm/tools/CompositeList.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/CompositeList.java	(revision 7109)
+++ trunk/src/org/openstreetmap/josm/tools/CompositeList.java	(revision 7109)
@@ -0,0 +1,36 @@
+// License: GPL. For details, see LICENSE file.
+package org.openstreetmap.josm.tools;
+
+import java.util.AbstractList;
+import java.util.List;
+
+/**
+ * Joined List build from two Lists (read-only).
+ *
+ * Extremely simple single-purpose implementation.
+ * @param <T>
+ * @since 7109
+ */
+public class CompositeList<T> extends AbstractList<T> {
+    private List<? extends T> a,b;
+
+    /**
+     * Constructs a new {@code CompositeList} from two lists.
+     * @param a First list
+     * @param b Second list
+     */
+    public CompositeList(List<? extends T> a, List<? extends T> b) {
+        this.a = a;
+        this.b = b;
+    }
+
+    @Override
+    public T get(int index) {
+        return index < a.size() ? a.get(index) : b.get(index - a.size());
+    }
+
+    @Override
+    public int size() {
+        return a.size() + b.size();
+    }
+}
Index: trunk/test/performance/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRendererPerformanceTest.java
===================================================================
--- trunk/test/performance/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRendererPerformanceTest.java	(revision 7108)
+++ trunk/test/performance/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRendererPerformanceTest.java	(revision 7109)
@@ -4,19 +4,18 @@
 import java.awt.Graphics2D;
 import java.awt.image.BufferedImage;
+import java.io.File;
 import java.io.FileInputStream;
 import java.io.InputStream;
-import java.io.File;
 
 import org.junit.BeforeClass;
 import org.junit.Test;
-import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.JOSMFixture;
 import org.openstreetmap.josm.data.Bounds;
 import org.openstreetmap.josm.data.osm.DataSet;
-import org.openstreetmap.josm.data.projection.Projections;
 import org.openstreetmap.josm.gui.NavigatableComponent;
 import org.openstreetmap.josm.gui.mappaint.MapPaintStyles;
 import org.openstreetmap.josm.gui.progress.NullProgressMonitor;
+import org.openstreetmap.josm.io.Compression;
 import org.openstreetmap.josm.io.OsmReader;
-import org.openstreetmap.josm.io.Compression;
 
 public class StyledMapRendererPerformanceTest {
@@ -34,6 +33,5 @@
     @BeforeClass
     public static void load() throws Exception {
-        Main.initApplicationPreferences();
-        Main.setProjection(Projections.getProjectionByCode("EPSG:3857")); // Mercator
+        JOSMFixture.createPerformanceTestFixture().init();
         img = new BufferedImage(IMG_WIDTH, IMG_HEIGHT, BufferedImage.TYPE_3BYTE_BGR);
         g = (Graphics2D)img.getGraphics();
@@ -53,8 +51,4 @@
             dsCity = OsmReader.parseDataSet(fisC, NullProgressMonitor.INSTANCE);
         }
-
-        // Warm up
-        new StyledMapRendererPerformanceTest().testRestrictionSmall();
-        new StyledMapRendererPerformanceTest().testCity();
     }
 
Index: trunk/test/performance/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSPerformanceTest.groovy
===================================================================
--- trunk/test/performance/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSPerformanceTest.groovy	(revision 7108)
+++ trunk/test/performance/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSPerformanceTest.groovy	(revision 7109)
@@ -111,5 +111,5 @@
         def mv = Main.map.mapView
 
-        BufferedImage img = mv.createImage(mv.getWidth(), mv.getHeight())
+        BufferedImage img = new BufferedImage(mv.getWidth(), mv.getHeight(), BufferedImage.TYPE_3BYTE_BGR)
         Graphics2D g = img.createGraphics()
         g.setClip(0,0, mv.getWidth(), mv.getHeight())
Index: trunk/test/unit/org/openstreetmap/josm/TestUtils.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/TestUtils.java	(revision 7108)
+++ trunk/test/unit/org/openstreetmap/josm/TestUtils.java	(revision 7109)
@@ -5,9 +5,11 @@
 import static org.junit.Assert.assertThat;
 import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
+import java.util.Arrays;
+import java.util.Comparator;
 import java.util.Map;
 
 import org.junit.Test;
-import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.data.osm.Node;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
@@ -65,3 +67,62 @@
     }
 
+    /**
+     * Checks that the given Comparator respects its contract on the given table.
+     * @param comparator The comparator to test
+     * @param array The array sorted for test purpose
+     */
+    public static <T> void checkComparableContract(Comparator<T> comparator, T[] array) {
+        System.out.println("Validating Comparable contract on array of "+array.length+" elements");
+        // Check each compare possibility
+        for (int i=0; i<array.length; i++) {
+            T r1 = array[i];
+            for (int j=i; j<array.length; j++) {
+                T r2 = array[j];
+                int a = comparator.compare(r1, r2);
+                int b = comparator.compare(r2, r1);
+                if (i==j || a==b) {
+                    if (a != 0 || b != 0) {
+                        fail(getFailMessage(r1, r2, a, b));
+                    }
+                } else {
+                    if (a != -b) {
+                        fail(getFailMessage(r1, r2, a, b));
+                    }
+                }
+                for (int k=j; k<array.length; k++) {
+                    T r3 = array[k];
+                    int c = comparator.compare(r1, r3);
+                    int d = comparator.compare(r2, r3);
+                    if (a > 0 && d > 0) {
+                        if (c <= 0) {
+                           fail(getFailMessage(r1, r2, r3, a, b, c, d));
+                        }
+                    } else if (a == 0 && d == 0) {
+                        if (c != 0) {
+                            fail(getFailMessage(r1, r2, r3, a, b, c, d));
+                        }
+                    } else if (a < 0 && d < 0) {
+                        if (c >= 0) {
+                            fail(getFailMessage(r1, r2, r3, a, b, c, d));
+                        }
+                    }
+                }
+            }
+        }
+        // Sort relation array
+        Arrays.sort(array, comparator);
+    }
+
+    private static <T> String getFailMessage(T o1, T o2, int a, int b) {
+        return new StringBuilder("Compared\no1: ").append(o1).append("\no2: ")
+        .append(o2).append("\ngave: ").append(a).append("/").append(b)
+        .toString();
+    }
+
+    private static <T> String getFailMessage(T o1, T o2, T o3, int a, int b, int c, int d) {
+        return new StringBuilder(getFailMessage(o1, o2, a, b))
+        .append("\nCompared\no1: ").append(o1).append("\no3: ").append(o3).append("\ngave: ").append(c)
+        .append("\nCompared\no2: ").append(o2).append("\no3: ").append(o3).append("\ngave: ").append(d)
+        .toString();
+    }
 }
Index: trunk/test/unit/org/openstreetmap/josm/gui/DefaultNameFormatterTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/gui/DefaultNameFormatterTest.java	(revision 7108)
+++ trunk/test/unit/org/openstreetmap/josm/gui/DefaultNameFormatterTest.java	(revision 7109)
@@ -3,5 +3,4 @@
 
 import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
 
 import java.io.FileInputStream;
@@ -9,5 +8,4 @@
 import java.io.InputStream;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Comparator;
 
@@ -75,56 +73,6 @@
             Relation[] relations = new ArrayList<>(ds.getRelations()).toArray(new Relation[0]);
 
-            // Check each compare possibility
-            for (int i=0; i<relations.length; i++) {
-                Relation r1 = relations[i];
-                for (int j=i; j<relations.length; j++) {
-                    Relation r2 = relations[j];
-                    int a = comparator.compare(r1, r2);
-                    int b = comparator.compare(r2, r1);
-                    if (i==j || a==b) {
-                        if (a != 0 || b != 0) {
-                            fail(getFailMessage(r1, r2, a, b));
-                        }
-                    } else {
-                        if (a != -b) {
-                            fail(getFailMessage(r1, r2, a, b));
-                        }
-                    }
-                    for (int k=j; k<relations.length; k++) {
-                        Relation r3 = relations[k];
-                        int c = comparator.compare(r1, r3);
-                        int d = comparator.compare(r2, r3);
-                        if (a > 0 && d > 0) {
-                            if (c <= 0) {
-                               fail(getFailMessage(r1, r2, r3, a, b, c, d));
-                            }
-                        } else if (a == 0 && d == 0) {
-                            if (c != 0) {
-                                fail(getFailMessage(r1, r2, r3, a, b, c, d));
-                            }
-                        } else if (a < 0 && d < 0) {
-                            if (c >= 0) {
-                                fail(getFailMessage(r1, r2, r3, a, b, c, d));
-                            }
-                        }
-                    }
-                }
-            }
-            // Sort relation array
-            Arrays.sort(relations, comparator);
+            TestUtils.checkComparableContract(comparator, relations);
         }
     }
-
-    private static String getFailMessage(Relation r1, Relation r2, int a, int b) {
-        return new StringBuilder("Compared\nr1: ").append(r1).append("\nr2: ")
-        .append(r2).append("\ngave: ").append(a).append("/").append(b)
-        .toString();
-    }
-
-    private static String getFailMessage(Relation r1, Relation r2, Relation r3, int a, int b, int c, int d) {
-        return new StringBuilder(getFailMessage(r1, r2, a, b))
-        .append("\nCompared\nr1: ").append(r1).append("\nr3: ").append(r3).append("\ngave: ").append(c)
-        .append("\nCompared\nr2: ").append(r2).append("\nr3: ").append(r3).append("\ngave: ").append(d)
-        .toString();
-    }
 }
