Index: trunk/test/unit/org/openstreetmap/josm/JOSMFixture.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/JOSMFixture.java	(revision 7076)
+++ trunk/test/unit/org/openstreetmap/josm/JOSMFixture.java	(revision 7081)
@@ -54,4 +54,5 @@
 
         Main.pref.init(false);
+        I18n.set(Main.pref.get("language", "en"));
 
         // init projection
Index: trunk/test/unit/org/openstreetmap/josm/actions/CreateMultipolygonActionTest.groovy
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/actions/CreateMultipolygonActionTest.groovy	(revision 7076)
+++ trunk/test/unit/org/openstreetmap/josm/actions/CreateMultipolygonActionTest.groovy	(revision 7081)
@@ -1,19 +1,19 @@
 package org.openstreetmap.josm.actions
 
-import org.openstreetmap.josm.Main
-import org.openstreetmap.josm.TestUtils;
+import org.junit.BeforeClass
+import org.junit.Test
+import org.openstreetmap.josm.JOSMFixture
+import org.openstreetmap.josm.TestUtils
 import org.openstreetmap.josm.actions.search.SearchCompiler
 import org.openstreetmap.josm.data.osm.Relation
 import org.openstreetmap.josm.data.osm.Way
-import org.openstreetmap.josm.data.projection.Projections
 import org.openstreetmap.josm.io.OsmReader
 import org.openstreetmap.josm.tools.Utils
 
-class CreateMultipolygonActionTest extends GroovyTestCase {
+class CreateMultipolygonActionTest {
 
-    @Override
-    void setUp() {
-        Main.initApplicationPreferences()
-        Main.setProjection(Projections.getProjectionByCode("EPSG:3857"));
+    @BeforeClass
+    public static void setUp() {
+        JOSMFixture.createUnitTestFixture().init();
     }
 
@@ -26,5 +26,6 @@
     }
 
-    void testCreate1() {
+    @Test
+    public void testCreate1() {
         def ds = OsmReader.parseDataSet(new FileInputStream(TestUtils.getTestDataRoot() + "create_multipolygon.osm"), null);
         def mp = CreateMultipolygonAction.createMultipolygonCommand(ds.getWays(), null)
@@ -33,5 +34,6 @@
     }
 
-    void testCreate2() {
+    @Test
+    public void testCreate2() {
         def ds = OsmReader.parseDataSet(new FileInputStream(TestUtils.getTestDataRoot() + "create_multipolygon.osm"), null);
         def ways = Utils.filter(ds.getWays(), SearchCompiler.compile("ref=1 OR ref:1.1.", false, false))
@@ -40,5 +42,6 @@
     }
 
-    void testUpdate1() {
+    @Test
+    public void testUpdate1() {
         def ds = OsmReader.parseDataSet(new FileInputStream(TestUtils.getTestDataRoot() + "create_multipolygon.osm"), null);
         def ways = Utils.filter(ds.getWays(), SearchCompiler.compile("ref=\".*1\$\"", false, true))
@@ -52,5 +55,6 @@
     }
 
-    void testUpdate2() {
+    @Test
+    public void testUpdate2() {
         def ds = OsmReader.parseDataSet(new FileInputStream(TestUtils.getTestDataRoot() + "create_multipolygon.osm"), null);
         def ways = Utils.filter(ds.getWays(), SearchCompiler.compile("ref=1 OR ref:1.1.1", false, false))
Index: trunk/test/unit/org/openstreetmap/josm/actions/search/SearchCompilerTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/actions/search/SearchCompilerTest.java	(revision 7076)
+++ trunk/test/unit/org/openstreetmap/josm/actions/search/SearchCompilerTest.java	(revision 7081)
@@ -4,5 +4,5 @@
 import org.junit.Before;
 import org.junit.Test;
-import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.JOSMFixture;
 import org.openstreetmap.josm.data.osm.Node;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
@@ -15,5 +15,5 @@
     @Before
     public void setUp() {
-        Main.initApplicationPreferences();
+        JOSMFixture.createUnitTestFixture().init();
     }
 
Index: trunk/test/unit/org/openstreetmap/josm/corrector/ReverseWayTagCorrectorTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/corrector/ReverseWayTagCorrectorTest.java	(revision 7076)
+++ trunk/test/unit/org/openstreetmap/josm/corrector/ReverseWayTagCorrectorTest.java	(revision 7081)
@@ -5,5 +5,5 @@
 import org.junit.BeforeClass;
 import org.junit.Test;
-import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.JOSMFixture;
 import org.openstreetmap.josm.data.osm.Tag;
 
@@ -18,5 +18,5 @@
     @BeforeClass
     public static void setUp() {
-        Main.initApplicationPreferences();
+        JOSMFixture.createUnitTestFixture().init();
     }
 
Index: trunk/test/unit/org/openstreetmap/josm/data/PreferencesTest.groovy
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/data/PreferencesTest.groovy	(revision 7076)
+++ trunk/test/unit/org/openstreetmap/josm/data/PreferencesTest.groovy	(revision 7081)
@@ -1,12 +1,13 @@
 package org.openstreetmap.josm.data
 
+import java.awt.Color
+
+import org.openstreetmap.josm.JOSMFixture
 import org.openstreetmap.josm.Main
-
-import java.awt.Color
 
 class PreferencesTest extends GroovyTestCase {
     @Override
     void setUp() {
-        Main.initApplicationPreferences()
+        JOSMFixture.createUnitTestFixture().init();
     }
 
Index: trunk/test/unit/org/openstreetmap/josm/data/osm/APIDataSetTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/data/osm/APIDataSetTest.java	(revision 7076)
+++ trunk/test/unit/org/openstreetmap/josm/data/osm/APIDataSetTest.java	(revision 7081)
@@ -9,5 +9,5 @@
 import org.junit.BeforeClass;
 import org.junit.Test;
-import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.JOSMFixture;
 import org.openstreetmap.josm.actions.upload.CyclicUploadDependencyException;
 import org.openstreetmap.josm.data.APIDataSet;
@@ -17,5 +17,5 @@
     @BeforeClass
     public static void init() {
-        Main.initApplicationPreferences();
+        JOSMFixture.createUnitTestFixture().init();
     }
 
Index: trunk/test/unit/org/openstreetmap/josm/data/osm/DataSetMergerTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/data/osm/DataSetMergerTest.java	(revision 7076)
+++ trunk/test/unit/org/openstreetmap/josm/data/osm/DataSetMergerTest.java	(revision 7081)
@@ -17,4 +17,5 @@
 import org.junit.BeforeClass;
 import org.junit.Test;
+import org.openstreetmap.josm.JOSMFixture;
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.data.coor.LatLon;
@@ -25,5 +26,5 @@
     @BeforeClass
     public static void init() {
-        Main.initApplicationPreferences();
+        JOSMFixture.createUnitTestFixture().init();
     }
 
Index: trunk/test/unit/org/openstreetmap/josm/data/osm/FilterTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/data/osm/FilterTest.java	(revision 7076)
+++ trunk/test/unit/org/openstreetmap/josm/data/osm/FilterTest.java	(revision 7081)
@@ -15,9 +15,8 @@
 import org.junit.BeforeClass;
 import org.junit.Test;
-import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.JOSMFixture;
 import org.openstreetmap.josm.actions.search.SearchAction.SearchMode;
 import org.openstreetmap.josm.actions.search.SearchCompiler.ParseError;
 import org.openstreetmap.josm.data.coor.LatLon;
-import org.openstreetmap.josm.data.projection.Projections;
 import org.openstreetmap.josm.gui.progress.NullProgressMonitor;
 import org.openstreetmap.josm.io.IllegalDataException;
@@ -31,6 +30,5 @@
     @BeforeClass
     public static void setUp() {
-        Main.setProjection(Projections.getProjectionByCode("EPSG:3857")); // Mercator
-        Main.initApplicationPreferences();
+        JOSMFixture.createUnitTestFixture().init();
     }
 
Index: trunk/test/unit/org/openstreetmap/josm/data/osm/OsmPrimitiveKeyHandlingTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/data/osm/OsmPrimitiveKeyHandlingTest.java	(revision 7076)
+++ trunk/test/unit/org/openstreetmap/josm/data/osm/OsmPrimitiveKeyHandlingTest.java	(revision 7081)
@@ -6,5 +6,5 @@
 import org.junit.BeforeClass;
 import org.junit.Test;
-import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.JOSMFixture;
 import org.openstreetmap.josm.data.coor.LatLon;
 
@@ -18,5 +18,5 @@
     @BeforeClass
     public static void init() {
-        Main.initApplicationPreferences();
+        JOSMFixture.createUnitTestFixture().init();
     }
 
Index: trunk/test/unit/org/openstreetmap/josm/data/osm/OsmPrimitiveTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/data/osm/OsmPrimitiveTest.java	(revision 7076)
+++ trunk/test/unit/org/openstreetmap/josm/data/osm/OsmPrimitiveTest.java	(revision 7081)
@@ -8,4 +8,5 @@
 import org.junit.BeforeClass;
 import org.junit.Test;
+import org.openstreetmap.josm.JOSMFixture;
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.data.coor.LatLon;
@@ -16,5 +17,5 @@
     @BeforeClass
     public static void init() {
-        Main.initApplicationPreferences();
+        JOSMFixture.createUnitTestFixture().init();
     }
 
Index: trunk/test/unit/org/openstreetmap/josm/data/osm/QuadBucketsTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/data/osm/QuadBucketsTest.java	(revision 7076)
+++ trunk/test/unit/org/openstreetmap/josm/data/osm/QuadBucketsTest.java	(revision 7081)
@@ -14,4 +14,5 @@
 import org.junit.BeforeClass;
 import org.junit.Test;
+import org.openstreetmap.josm.JOSMFixture;
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.data.coor.LatLon;
@@ -24,5 +25,5 @@
     @BeforeClass
     public static void init() {
-        Main.initApplicationPreferences();
+        JOSMFixture.createUnitTestFixture().init();
     }
 
@@ -78,9 +79,9 @@
         try (InputStream fis = new FileInputStream("data_nodist/restriction.osm")) {
             DataSet ds = OsmReader.parseDataSet(fis, NullProgressMonitor.INSTANCE);
-    
+
             for (Node n: ds.getNodes()) {
                 n.setCoor(new LatLon(10, 10));
             }
-    
+
             removeAllTest(ds);
         }
Index: trunk/test/unit/org/openstreetmap/josm/data/osm/RelationTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/data/osm/RelationTest.java	(revision 7076)
+++ trunk/test/unit/org/openstreetmap/josm/data/osm/RelationTest.java	(revision 7081)
@@ -7,7 +7,6 @@
 import org.junit.BeforeClass;
 import org.junit.Test;
-import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.JOSMFixture;
 import org.openstreetmap.josm.data.coor.LatLon;
-import org.openstreetmap.josm.data.projection.Projections;
 
 public class RelationTest {
@@ -18,6 +17,5 @@
     @BeforeClass
     public static void setUp() {
-        Main.setProjection(Projections.getProjectionByCode("EPSG:3857")); // Mercator
-        Main.initApplicationPreferences();
+        JOSMFixture.createUnitTestFixture().init();
     }
 
Index: trunk/test/unit/org/openstreetmap/josm/data/osm/visitor/MergeSourceBuildingVisitorTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/data/osm/visitor/MergeSourceBuildingVisitorTest.java	(revision 7076)
+++ trunk/test/unit/org/openstreetmap/josm/data/osm/visitor/MergeSourceBuildingVisitorTest.java	(revision 7081)
@@ -11,5 +11,5 @@
 import org.junit.BeforeClass;
 import org.junit.Test;
-import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.JOSMFixture;
 import org.openstreetmap.josm.data.coor.LatLon;
 import org.openstreetmap.josm.data.osm.DataSet;
@@ -20,5 +20,4 @@
 import org.openstreetmap.josm.data.osm.RelationMember;
 import org.openstreetmap.josm.data.osm.Way;
-import org.openstreetmap.josm.data.projection.Projections;
 
 public class MergeSourceBuildingVisitorTest {
@@ -39,10 +38,9 @@
     @BeforeClass
     public static void setUp() {
-        Main.setProjection(Projections.getProjectionByCode("EPSG:3857")); // Mercator
-        Main.initApplicationPreferences();
-    }
-
-    @Test
-    public void test_Nodes() {
+        JOSMFixture.createUnitTestFixture().init();
+    }
+
+    @Test
+    public void testNodes() {
         DataSet source = new DataSet();
         Node n1 = new Node(1);
@@ -79,5 +77,5 @@
 
     @Test
-    public void test_OneWay() {
+    public void testOneWay() {
         DataSet source = new DataSet();
         Node n1 = new Node(1);
@@ -111,5 +109,5 @@
 
     @Test
-    public void test_OneWay_NodesSelectedToo() {
+    public void testOneWayNodesSelectedToo() {
         DataSet source = new DataSet();
         Node n1 = new Node(1);
@@ -143,5 +141,5 @@
 
     @Test
-    public void test_OneWay_Incomplete() {
+    public void testOneWayIncomplete() {
         DataSet source = new DataSet();
         Way w1 = new Way(3);
@@ -161,5 +159,5 @@
 
     @Test
-    public void test_OneRelation_ExistingMembersSelected() {
+    public void testOneRelationExistingMembersSelected() {
         DataSet source = new DataSet();
         Relation r1 = new Relation(1, 1);
@@ -220,5 +218,5 @@
 
     @Test
-    public void test_OneRelation_ExistingMembersNotSelected() {
+    public void testOneRelationExistingMembersNotSelected() {
         DataSet source = new DataSet();
         Relation r1 = new Relation(1, 1);
@@ -279,5 +277,5 @@
 
     @Test
-    public void test_OneRelation_NewMembersNotSelected() {
+    public void testOneRelationNewMembersNotSelected() {
         DataSet source = new DataSet();
         Relation r1 = new Relation();
@@ -346,5 +344,5 @@
 
     @Test
-    public void test_OneRelation_Existing_Recursive() {
+    public void testOneRelationExistingRecursive() {
         DataSet source = new DataSet();
         Relation r1 = new Relation(1, 1);
@@ -365,5 +363,5 @@
 
     @Test
-    public void test_OneRelation_New_Recursive() {
+    public void testOneRelationNewRecursive() {
         DataSet source = new DataSet();
         Relation r1 = new Relation();
@@ -385,5 +383,5 @@
 
     @Test
-    public void test_TwoRelation_Existing_Circular() {
+    public void testTwoRelationExistingCircular() {
         DataSet source = new DataSet();
         Relation r1 = new Relation(1, 1);
Index: trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionRegressionTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionRegressionTest.java	(revision 7076)
+++ trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionRegressionTest.java	(revision 7081)
@@ -23,5 +23,5 @@
 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.coor.EastNorth;
@@ -120,14 +120,14 @@
                 }
                 TestData next = new TestData();
-    
+
                 Pair<Double,Double> ll = readLine("ll", in.readLine());
                 Pair<Double,Double> en = readLine("en", in.readLine());
                 Pair<Double,Double> ll2 = readLine("ll2", in.readLine());
-    
+
                 next.code = line;
                 next.ll = new LatLon(ll.a, ll.b);
                 next.en = new EastNorth(en.a, en.b);
                 next.ll2 = new LatLon(ll2.a, ll2.b);
-    
+
                 result.add(next);
             }
@@ -150,5 +150,5 @@
     @BeforeClass
     public static void setUp() {
-        Main.initApplicationPreferences();
+        JOSMFixture.createUnitTestFixture().init();
     }
 
Index: trunk/test/unit/org/openstreetmap/josm/data/validation/tests/ConditionalKeysTest.groovy
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/data/validation/tests/ConditionalKeysTest.groovy	(revision 7076)
+++ trunk/test/unit/org/openstreetmap/josm/data/validation/tests/ConditionalKeysTest.groovy	(revision 7081)
@@ -2,14 +2,14 @@
 package org.openstreetmap.josm.data.validation.tests
 
-import org.openstreetmap.josm.Main
+import org.openstreetmap.josm.JOSMFixture
 import org.openstreetmap.josm.gui.preferences.map.TaggingPresetPreference
 
 class ConditionalKeysTest extends GroovyTestCase {
 
-    def test = new ConditionalKeys()
+    ConditionalKeys test = new ConditionalKeys()
 
     @Override
     void setUp() {
-        Main.initApplicationPreferences();
+        JOSMFixture.createUnitTestFixture().init();
         TaggingPresetPreference.readFromPreferences()
         test.initialize()
@@ -40,5 +40,4 @@
         assert !test.isValueValid("motor_vehicle:conditional", "no @ (10:00until18:00 AND length>5)")
         assert test.isValueValid("maxspeed:hgv:conditional", "60 @ (weight>7.5)")
-
     }
 }
Index: trunk/test/unit/org/openstreetmap/josm/data/validation/tests/DuplicateNodeTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/data/validation/tests/DuplicateNodeTest.java	(revision 7076)
+++ trunk/test/unit/org/openstreetmap/josm/data/validation/tests/DuplicateNodeTest.java	(revision 7081)
@@ -6,9 +6,8 @@
 import org.junit.BeforeClass;
 import org.junit.Test;
-import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.JOSMFixture;
 import org.openstreetmap.josm.data.coor.LatLon;
 import org.openstreetmap.josm.data.osm.DataSet;
 import org.openstreetmap.josm.data.osm.Node;
-import org.openstreetmap.josm.data.projection.Projections;
 import org.openstreetmap.josm.gui.progress.NullProgressMonitor;
 
@@ -23,6 +22,5 @@
     @BeforeClass
     public static void setUp() {
-        Main.setProjection(Projections.getProjectionByCode("EPSG:3857")); // Mercator
-        Main.initApplicationPreferences();
+        JOSMFixture.createUnitTestFixture().init();
     }
 
Index: trunk/test/unit/org/openstreetmap/josm/data/validation/tests/HighwaysTest.groovy
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/data/validation/tests/HighwaysTest.groovy	(revision 7076)
+++ trunk/test/unit/org/openstreetmap/josm/data/validation/tests/HighwaysTest.groovy	(revision 7081)
@@ -2,9 +2,8 @@
 package org.openstreetmap.josm.data.validation.tests
 
-import org.openstreetmap.josm.Main
+import org.openstreetmap.josm.JOSMFixture
 import org.openstreetmap.josm.data.coor.LatLon
 import org.openstreetmap.josm.data.osm.DataSet
 import org.openstreetmap.josm.data.osm.Way
-import org.openstreetmap.josm.data.projection.Projections
 
 class HighwaysTest extends GroovyTestCase {
@@ -12,6 +11,5 @@
     @Override
     void setUp() {
-        Main.initApplicationPreferences()
-        Main.setProjection(Projections.getProjectionByCode("EPSG:3857"));
+        JOSMFixture.createUnitTestFixture().init();
     }
 
Index: trunk/test/unit/org/openstreetmap/josm/data/validation/tests/LanesTest.groovy
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/data/validation/tests/LanesTest.groovy	(revision 7076)
+++ trunk/test/unit/org/openstreetmap/josm/data/validation/tests/LanesTest.groovy	(revision 7081)
@@ -1,9 +1,9 @@
 package org.openstreetmap.josm.data.validation.tests
 
-import org.openstreetmap.josm.TestUtils;
+import org.openstreetmap.josm.TestUtils
 
 class LanesTest extends GroovyTestCase {
 
-    def lanes = new Lanes()
+    Lanes lanes = new Lanes()
 
     @Override
Index: trunk/test/unit/org/openstreetmap/josm/data/validation/tests/MapCSSTagCheckerTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/data/validation/tests/MapCSSTagCheckerTest.java	(revision 7076)
+++ trunk/test/unit/org/openstreetmap/josm/data/validation/tests/MapCSSTagCheckerTest.java	(revision 7081)
@@ -15,5 +15,5 @@
 import org.junit.BeforeClass;
 import org.junit.Test;
-import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.JOSMFixture;
 import org.openstreetmap.josm.TestUtils;
 import org.openstreetmap.josm.command.ChangePropertyCommand;
@@ -33,5 +33,5 @@
     @BeforeClass
     public static void setUp() {
-        Main.initApplicationPreferences();
+        JOSMFixture.createUnitTestFixture().init();
     }
 
Index: trunk/test/unit/org/openstreetmap/josm/data/validation/tests/OpeningHourTestTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/data/validation/tests/OpeningHourTestTest.java	(revision 7076)
+++ trunk/test/unit/org/openstreetmap/josm/data/validation/tests/OpeningHourTestTest.java	(revision 7081)
@@ -16,5 +16,5 @@
 import org.junit.Before;
 import org.junit.Test;
-import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.JOSMFixture;
 import org.openstreetmap.josm.data.osm.Tag;
 import org.openstreetmap.josm.data.validation.Severity;
@@ -37,5 +37,5 @@
     @Before
     public void setUp() throws Exception {
-        Main.initApplicationPreferences();
+        JOSMFixture.createUnitTestFixture().init();
         OPENING_HOUR_TEST.initialize();
     }
@@ -135,5 +135,5 @@
         final String key = "opening_hours";
         assertThat(OPENING_HOUR_TEST.checkOpeningHourSyntax(key, "Mo,Tu 04-17").get(0).getSeverity(), is(Severity.WARNING));
-        assertThat(OPENING_HOUR_TEST.checkOpeningHourSyntax(key, "Mo,Tu 04-17").get(0).getMessage(), 
+        assertThat(OPENING_HOUR_TEST.checkOpeningHourSyntax(key, "Mo,Tu 04-17").get(0).getMessage(),
                 is(key + " - Mo,Tu 04-17 <--- (Time range without minutes specified. Not very explicit! Please use this syntax instead e.g. \"12:00-14:00\".)"));
         assertThat(OPENING_HOUR_TEST.checkOpeningHourSyntax(key, "Mo,Tu 04-17").get(0).getPrettifiedValue(), is("Mo,Tu 04:00-17:00"));
Index: trunk/test/unit/org/openstreetmap/josm/data/validation/tests/UnconnectedWaysTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/data/validation/tests/UnconnectedWaysTest.java	(revision 7076)
+++ trunk/test/unit/org/openstreetmap/josm/data/validation/tests/UnconnectedWaysTest.java	(revision 7081)
@@ -10,7 +10,6 @@
 import org.junit.Before;
 import org.junit.Test;
-import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.JOSMFixture;
 import org.openstreetmap.josm.data.osm.DataSet;
-import org.openstreetmap.josm.data.projection.Projections;
 import org.openstreetmap.josm.gui.progress.NullProgressMonitor;
 import org.openstreetmap.josm.io.OsmReader;
@@ -26,6 +25,5 @@
     public void setUp() throws Exception {
         bib = new UnconnectedWays.UnconnectedHighways();
-        Main.initApplicationPreferences();
-        Main.setProjection(Projections.getProjectionByCode("EPSG:3857"));
+        JOSMFixture.createUnitTestFixture().init();
         bib.initialize();
         bib.startTest(null);
Index: trunk/test/unit/org/openstreetmap/josm/gui/JosmUserIdentityManagerTest.groovy
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/gui/JosmUserIdentityManagerTest.groovy	(revision 7076)
+++ trunk/test/unit/org/openstreetmap/josm/gui/JosmUserIdentityManagerTest.groovy	(revision 7081)
@@ -14,9 +14,7 @@
 	final shouldFail = new GroovyTestCase().&shouldFail
 
-	private static JOSMFixture josmFixture
-
 	@BeforeClass
 	public static void initTestCase() {
-	    josmFixture = JOSMFixture.createFunctionalTestFixture()
+	    JOSMFixture.createUnitTestFixture().init()
 	}
 
Index: trunk/test/unit/org/openstreetmap/josm/gui/SystemOfMeasurementTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/gui/SystemOfMeasurementTest.java	(revision 7076)
+++ trunk/test/unit/org/openstreetmap/josm/gui/SystemOfMeasurementTest.java	(revision 7081)
@@ -9,5 +9,5 @@
 import org.junit.BeforeClass;
 import org.junit.Test;
-import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.JOSMFixture;
 import org.openstreetmap.josm.data.SystemOfMeasurement;
 
@@ -22,5 +22,5 @@
     @BeforeClass
     public static void setUp() {
-        Main.initApplicationPreferences();
+        JOSMFixture.createUnitTestFixture().init();
     }
 
Index: trunk/test/unit/org/openstreetmap/josm/gui/conflict/nodes/NodeListMergeModelTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/gui/conflict/nodes/NodeListMergeModelTest.java	(revision 7076)
+++ trunk/test/unit/org/openstreetmap/josm/gui/conflict/nodes/NodeListMergeModelTest.java	(revision 7081)
@@ -18,5 +18,5 @@
 import org.junit.BeforeClass;
 import org.junit.Test;
-import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.JOSMFixture;
 import org.openstreetmap.josm.data.osm.DatasetFactory;
 import org.openstreetmap.josm.data.osm.Node;
@@ -31,5 +31,5 @@
     @BeforeClass
     public static void init() {
-        Main.initApplicationPreferences();
+        JOSMFixture.createUnitTestFixture().init();
     }
 
Index: trunk/test/unit/org/openstreetmap/josm/gui/conflict/properties/PropertiesMergeModelTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/gui/conflict/properties/PropertiesMergeModelTest.java	(revision 7076)
+++ trunk/test/unit/org/openstreetmap/josm/gui/conflict/properties/PropertiesMergeModelTest.java	(revision 7081)
@@ -12,5 +12,5 @@
 import org.junit.BeforeClass;
 import org.junit.Test;
-import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.JOSMFixture;
 import org.openstreetmap.josm.data.conflict.Conflict;
 import org.openstreetmap.josm.data.coor.LatLon;
@@ -20,5 +20,4 @@
 import org.openstreetmap.josm.data.osm.Relation;
 import org.openstreetmap.josm.data.osm.Way;
-import org.openstreetmap.josm.data.projection.Projections;
 import org.openstreetmap.josm.gui.conflict.pair.MergeDecisionType;
 import org.openstreetmap.josm.gui.conflict.pair.properties.PropertiesMergeModel;
@@ -46,6 +45,5 @@
     @BeforeClass
     public static void init() {
-        Main.setProjection(Projections.getProjectionByCode("EPSG:4326"));
-        Main.initApplicationPreferences();
+        JOSMFixture.createUnitTestFixture().init();
     }
 
Index: trunk/test/unit/org/openstreetmap/josm/gui/conflict/tags/TagMergeItemTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/gui/conflict/tags/TagMergeItemTest.java	(revision 7076)
+++ trunk/test/unit/org/openstreetmap/josm/gui/conflict/tags/TagMergeItemTest.java	(revision 7081)
@@ -8,5 +8,5 @@
 import org.junit.BeforeClass;
 import org.junit.Test;
-import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.JOSMFixture;
 import org.openstreetmap.josm.data.osm.Node;
 import org.openstreetmap.josm.gui.conflict.pair.MergeDecisionType;
@@ -17,5 +17,5 @@
     @BeforeClass
     public static void init() {
-        Main.initApplicationPreferences();
+        JOSMFixture.createUnitTestFixture().init();
     }
 
Index: trunk/test/unit/org/openstreetmap/josm/gui/conflict/tags/TagMergeModelTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/gui/conflict/tags/TagMergeModelTest.java	(revision 7076)
+++ trunk/test/unit/org/openstreetmap/josm/gui/conflict/tags/TagMergeModelTest.java	(revision 7081)
@@ -12,5 +12,5 @@
 import org.junit.BeforeClass;
 import org.junit.Test;
-import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.JOSMFixture;
 import org.openstreetmap.josm.data.osm.Node;
 import org.openstreetmap.josm.gui.conflict.pair.MergeDecisionType;
@@ -23,5 +23,5 @@
     @BeforeClass
     public static void init() {
-        Main.initApplicationPreferences();
+        JOSMFixture.createUnitTestFixture().init();
     }
 
Index: trunk/test/unit/org/openstreetmap/josm/gui/mappaint/MapCSSWithExtendedTextDirectivesTest.groovy
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/gui/mappaint/MapCSSWithExtendedTextDirectivesTest.groovy	(revision 7076)
+++ trunk/test/unit/org/openstreetmap/josm/gui/mappaint/MapCSSWithExtendedTextDirectivesTest.groovy	(revision 7081)
@@ -4,10 +4,10 @@
 
 import org.junit.*
-import org.openstreetmap.josm.JOSMFixture;
+import org.openstreetmap.josm.JOSMFixture
 import org.openstreetmap.josm.gui.mappaint.LabelCompositionStrategy.DeriveLabelFromNameTagsCompositionStrategy
 import org.openstreetmap.josm.gui.mappaint.LabelCompositionStrategy.TagLookupCompositionStrategy
 import org.openstreetmap.josm.gui.mappaint.MapPaintStyles.TagKeyReference
+
 class MapCSSWithExtendedTextDirectivesTest {
-    
 
     @BeforeClass
@@ -20,15 +20,15 @@
         Cascade c = new Cascade()
         c.put("text", new Keyword("auto"))
-        
+
         TextElement te = TextElement.create(c, Color.WHITE, false /* no default annotate */)
         assert te.labelCompositionStrategy != null
         assert te.labelCompositionStrategy instanceof DeriveLabelFromNameTagsCompositionStrategy
     }
-    
+
     @Test
     public void createTextElementComposingTextFromTag() {
         Cascade c = new Cascade()
         c.put("text", new TagKeyReference("my_name"))
-        
+
         TextElement te = TextElement.create(c, Color.WHITE, false /* no default annotate */)
         assert te.labelCompositionStrategy != null
@@ -36,12 +36,11 @@
         assert te.labelCompositionStrategy.getDefaultLabelTag() == "my_name"
     }
-        
+
     @Test
     public void createNullStrategy() {
         Cascade c = new Cascade()
-        
+
         TextElement te = TextElement.create(c, Color.WHITE, false /* no default annotate */)
-        assert te.labelCompositionStrategy == null
+        assert te == null
     }
 }
-
Index: trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/ChildOrParentSelectorTest.groovy
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/ChildOrParentSelectorTest.groovy	(revision 7076)
+++ trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/ChildOrParentSelectorTest.groovy	(revision 7081)
@@ -7,5 +7,5 @@
 
 import org.junit.*
-import org.openstreetmap.josm.JOSMFixture;
+import org.openstreetmap.josm.JOSMFixture
 import org.openstreetmap.josm.data.coor.LatLon
 import org.openstreetmap.josm.data.osm.DataSet
@@ -19,19 +19,19 @@
 class ChildOrParentSelectorTest {
     static private Logger logger = Logger.getLogger(ChildOrParentSelectorTest.class.getName());
-    
+
     def shouldFail = new GroovyTestCase().&shouldFail
-    
+
     def DataSet ds;
-    
+
     @BeforeClass
     public static void createJOSMFixture(){
         JOSMFixture.createUnitTestFixture().init()
     }
-    
+
     @Before
     public void setUp() {
         ds = new DataSet()
     }
-    
+
     def relation(id) {
         def r = new Relation(id,1)
@@ -39,5 +39,5 @@
         return r
     }
-    
+
     def node(id) {
         def n = new Node(id,1)
@@ -46,5 +46,5 @@
         return n
     }
-    
+
     def way(id){
         def w = new Way(id,1)
@@ -52,13 +52,12 @@
         return w
     }
-    
+
     def ChildOrParentSelector parse(css){
          MapCSSStyleSource source = new MapCSSStyleSource(css)
          source.loadStyleSource()
          assert source.rules.size() == 1
-         assert source.rules[0].selectors.size() == 1
-         return source.rules[0].selectors[0]
+         return source.rules[0].selector
     }
-    
+
     @Test
     @Ignore
@@ -68,13 +67,13 @@
         """
         ChildOrParentSelector selector = parse(css)
-        
+
         Relation r = relation(1)
         Node n = node(1)
         r.addMember(new RelationMember("my_role", n))
         Environment e = new Environment().withChild(n)
-        
-        assert selector.matches(e)        
+
+        assert selector.matches(e)
     }
-    
+
     @Test
     @Ignore
@@ -84,13 +83,13 @@
         """
         ChildOrParentSelector selector = parse(css)
-        
+
         Relation r = relation(1)
         Node n = node(1)
         r.addMember(new RelationMember("my_role", n))
         Environment e = new Environment().withChild(n)
-        
+
         assert selector.matches(e)
     }
-        
+
     @Test
     @Ignore
@@ -100,13 +99,13 @@
         """
         ChildOrParentSelector selector = parse(css)
-        
+
         Relation r = relation(1)
         Node n = node(1)
         r.addMember(new RelationMember("my_role", n))
         Environment e = new Environment().withChild(n)
-        
+
         assert !selector.matches(e)
     }
-    
+
     @Test
     @Ignore
@@ -114,8 +113,8 @@
         def css = """
            way < relation {}
-        """        
+        """
         ChildOrParentSelector selector = parse(css)
-        assert selector.parentSelector
-        
+        assert selector.type == Selector.ChildOrParentSelectorType.PARENT
+
     }
     @Test
@@ -124,7 +123,7 @@
            way <[role != "my_role"] relation {}
         """
-        ChildOrParentSelector selector = parse(css)   
-        assert selector.parentSelector     
-        
+        ChildOrParentSelector selector = parse(css)
+        assert selector.type == Selector.ChildOrParentSelectorType.PARENT
+
         Relation r = relation(1)
         Way w1 = way(1)
@@ -133,5 +132,5 @@
         Way w2 = way(2)
         w2.setNodes([node(21), node(22)])
-        
+
         Way w3 = way(3)
         w3.setNodes([node(31), node(32)])
@@ -140,9 +139,9 @@
         r.addMember(new RelationMember("my_role", w2))
         r.addMember(new RelationMember("another role", w3))
-        
+
         Environment e = new Environment().withPrimitive(r)
         assert selector.matches(e)
     }
-    
+
     @Test
     public void matches_6() {
@@ -150,6 +149,6 @@
            relation >[role != "my_role"] way {}
         """
-        ChildOrParentSelector selector = parse(css)     
-        
+        ChildOrParentSelector selector = parse(css)
+
         Relation r = relation(1)
         Way w1 = way(1)
@@ -158,5 +157,5 @@
         Way w2 = way(2)
         w2.setNodes([node(21), node(22)])
-        
+
         Way w3 = way(3)
         w3.setNodes([node(31), node(32)])
@@ -165,11 +164,11 @@
         r.addMember(new RelationMember("my_role", w2))
         r.addMember(new RelationMember("another role", w3))
-        
+
         Environment e = new Environment().withPrimitive(w1)
         assert !selector.matches(e)
-        
+
         e = new Environment().withPrimitive(w2)
         assert !selector.matches(e)
-        
+
         e = new Environment().withPrimitive(w3)
         assert selector.matches(e)
Index: trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/KeyConditionTest.groovy
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/KeyConditionTest.groovy	(revision 7076)
+++ trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/KeyConditionTest.groovy	(revision 7081)
@@ -5,5 +5,5 @@
 
 import org.junit.*
-import org.openstreetmap.josm.JOSMFixture;
+import org.openstreetmap.josm.JOSMFixture
 import org.openstreetmap.josm.data.coor.LatLon
 import org.openstreetmap.josm.data.osm.DataSet
@@ -17,17 +17,17 @@
 
     def shouldFail = new GroovyTestCase().&shouldFail
-    
+
     def DataSet ds;
-    
+
     @BeforeClass
     public static void createJOSMFixture(){
         JOSMFixture.createUnitTestFixture().init()
     }
-    
+
     @Before
     public void setUp() {
         ds = new DataSet()
     }
-    
+
     def relation(id) {
         def r = new Relation(id,1)
@@ -35,5 +35,5 @@
         return r
     }
-    
+
     def node(id) {
         def n = new Node(id,1)
@@ -42,33 +42,33 @@
         return n
     }
-    
+
     @Test
     public void create() {
-        
+
         // ["a label"]
-        Condition c = Condition.create("a key", false, false, Context.PRIMITIVE)
+        Condition c = Condition.createKeyCondition("a key", false, Condition.KeyMatchType.FALSE, Context.PRIMITIVE)
         // ["a label"?]
-        c = Condition.create("a key", false, true, Context.PRIMITIVE)
+        c = Condition.createKeyCondition("a key", false, Condition.KeyMatchType.TRUE, Context.PRIMITIVE)
         // [!"a label"]
-        c = Condition.create("a key", true, false, Context.PRIMITIVE)
+        c = Condition.createKeyCondition("a key", true, Condition.KeyMatchType.FALSE, Context.PRIMITIVE)
         // [!"a label"?]
-        c = Condition.create("a key", true, true, Context.PRIMITIVE)
-       
+        c = Condition.createKeyCondition("a key", true, Condition.KeyMatchType.TRUE, Context.PRIMITIVE)
+
         // ["a label"]
-        c = Condition.create("a key", false, false, Context.LINK)
+        c = Condition.createKeyCondition("a key", false, null, Context.LINK)
         // [!"a label"]
-        c = Condition.create("a key", true, false, Context.LINK)
-        
+        c = Condition.createKeyCondition("a key", true, null, Context.LINK)
+
         shouldFail(MapCSSException) {
             // ["a label"?]
-           c = Condition.create("a key", false, true, Context.LINK)
+           c = Condition.createKeyCondition("a key", false, Condition.KeyMatchType.TRUE, Context.LINK)
         }
-        
+
         shouldFail(MapCSSException) {
             // [!"a label"?]
-            c = Condition.create("a key", true, true, Context.LINK)
+            c = Condition.createKeyCondition("a key", true, Condition.KeyMatchType.TRUE, Context.LINK)
         }
     }
-    
+
     @Test
     public void applies_1() {
@@ -76,14 +76,14 @@
         Node n = node(1)
         r.addMember(new RelationMember("my_role", n))
-        
+
         Environment e = new Environment().withPrimitive(n).withParent(r).withIndex(0).withLinkContext()
-        
-        Condition cond = Condition.create("my_role", false, false, Context.LINK)
-        assert cond.applies(e)        
-        
-        cond = Condition.create("my_role", true, false, Context.LINK)
+
+        Condition cond = Condition.createKeyCondition("my_role", false, null, Context.LINK)
+        assert cond.applies(e)
+
+        cond = Condition.createKeyCondition("my_role", true, null, Context.LINK)
         assert !cond.applies(e)
     }
-    
+
     @Test
     public void applies_2() {
@@ -91,13 +91,12 @@
         Node n = node(1)
         r.addMember(new RelationMember("my_role", n))
-        
+
         Environment e = new Environment().withPrimitive(n).withParent(r).withIndex(0).withLinkContext()
-        
-        Condition cond = Condition.create("another_role", false, false, Context.LINK)
+
+        Condition cond = Condition.createKeyCondition("another_role", false, null, Context.LINK)
         assert !cond.applies(e)
-        
-        cond = Condition.create("another_role", true, false, Context.LINK)
+
+        cond = Condition.createKeyCondition("another_role", true, null, Context.LINK)
         assert cond.applies(e)
-    }    
+    }
 }
-
Index: trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/KeyValueConditionTest.groovy
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/KeyValueConditionTest.groovy	(revision 7076)
+++ trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/KeyValueConditionTest.groovy	(revision 7081)
@@ -5,5 +5,5 @@
 
 import org.junit.*
-import org.openstreetmap.josm.JOSMFixture;
+import org.openstreetmap.josm.JOSMFixture
 import org.openstreetmap.josm.data.coor.LatLon
 import org.openstreetmap.josm.data.osm.DataSet
@@ -19,17 +19,17 @@
 
     def shouldFail = new GroovyTestCase().&shouldFail
-    
+
     def DataSet ds;
-    
+
     @BeforeClass
     public static void createJOSMFixture(){
         JOSMFixture.createUnitTestFixture().init()
     }
-    
+
     @Before
     public void setUp() {
         ds = new DataSet()
     }
-    
+
     def relation(id) {
         def r = new Relation(id,1)
@@ -37,5 +37,5 @@
         return r
     }
-    
+
     def node(id) {
         def n = new Node(id,1)
@@ -44,17 +44,17 @@
         return n
     }
-    
+
     @Test
     public void create() {
-        Condition c = Condition.create("a key", "a value", Op.EQ, Context.PRIMITIVE)
-        
-        c = Condition.create("role", "a role", Op.EQ, Context.LINK)
-        c = Condition.create("RoLe", "a role", Op.EQ, Context.LINK)
-        
+        Condition c = Condition.createKeyValueCondition("a key", "a value", Op.EQ, Context.PRIMITIVE, false)
+
+        c = Condition.createKeyValueCondition("role", "a role", Op.EQ, Context.LINK, false)
+        c = Condition.createKeyValueCondition("RoLe", "a role", Op.EQ, Context.LINK, false)
+
         shouldFail(MapCSSException) {
-            c = Condition.create("an arbitry tag", "a role", Op.EQ, Context.LINK)
+            c = Condition.createKeyValueCondition("an arbitry tag", "a role", Op.EQ, Context.LINK, false)
         }
     }
-    
+
     @Test
     public void applies_1() {
@@ -62,14 +62,14 @@
         Node n = node(1)
         r.addMember(new RelationMember("my_role", n))
-        
+
         Environment e = new Environment().withPrimitive(n).withParent(r).withLinkContext().withIndex(0)
-        
+
         Condition cond = new Condition.RoleCondition("my_role", Op.EQ)
-        assert cond.applies(e)        
-        
+        assert cond.applies(e)
+
         cond = new Condition.RoleCondition("another_role", Op.EQ)
         assert !cond.applies(e)
     }
-    
+
     @Test
     public void applies_2() {
@@ -77,16 +77,12 @@
         Node n = node(1)
         r.addMember(new RelationMember("my_role", n))
-        
+
         Environment e = new Environment().withPrimitive(n).withParent(r).withIndex(0).withLinkContext()
-        
-        Condition cond = Condition.create("role", "my_role", Op.NEQ, Context.LINK)
+
+        Condition cond = Condition.createKeyValueCondition("role", "my_role", Op.NEQ, Context.LINK, false)
         assert !cond.applies(e)
-        
-        cond = Condition.create("role", "another_role", Op.NEQ, Context.LINK)
+
+        cond = Condition.createKeyValueCondition("role", "another_role", Op.NEQ, Context.LINK, false)
         assert cond.applies(e)
     }
-    
-    
-    
 }
-
Index: trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSParserTest.groovy
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSParserTest.groovy	(revision 7076)
+++ trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSParserTest.groovy	(revision 7081)
@@ -5,11 +5,11 @@
 import org.junit.Before
 import org.junit.Test
+import org.openstreetmap.josm.JOSMFixture
 import org.openstreetmap.josm.Main
-import org.openstreetmap.josm.TestUtils;
+import org.openstreetmap.josm.TestUtils
 import org.openstreetmap.josm.data.coor.LatLon
 import org.openstreetmap.josm.data.osm.DataSet
 import org.openstreetmap.josm.data.osm.OsmPrimitive
 import org.openstreetmap.josm.data.osm.Way
-import org.openstreetmap.josm.data.projection.Projections
 import org.openstreetmap.josm.gui.mappaint.Environment
 import org.openstreetmap.josm.gui.mappaint.MultiCascade
@@ -35,6 +35,5 @@
     @Before
     public void setUp() throws Exception {
-        Main.initApplicationPreferences()
-        Main.setProjection(Projections.getProjectionByCode("EPSG:3857"));
+        JOSMFixture.createUnitTestFixture().init();
     }
 
@@ -57,5 +56,5 @@
     public void testClassCondition() throws Exception {
         def conditions = ((Selector.GeneralSelector) getParser("way[name=X].highway:closed").selector()).conds
-        assert conditions.get(0) instanceof Condition.KeyValueCondition
+        assert conditions.get(0) instanceof Condition.SimpleKeyValueCondition
         assert conditions.get(0).applies(getEnvironment("name", "X"))
         assert conditions.get(1) instanceof Condition.ClassCondition
@@ -89,7 +88,6 @@
     @Test
     public void testEqualCondition() throws Exception {
-        def condition = (Condition.KeyValueCondition) getParser("[surface=paved]").condition(Condition.Context.PRIMITIVE)
-        assert condition instanceof Condition.KeyValueCondition
-        assert Condition.Op.EQ.equals(condition.op)
+        def condition = (Condition.SimpleKeyValueCondition) getParser("[surface=paved]").condition(Condition.Context.PRIMITIVE)
+        assert condition instanceof Condition.SimpleKeyValueCondition
         assert "surface".equals(condition.k)
         assert "paved".equals(condition.v)
@@ -215,5 +213,5 @@
 
     @Test
-    public void testTicket80711() throws Exception {
+    public void testTicket8071() throws Exception {
         def sheet = new MapCSSStyleSource("")
         getParser("*[rcn_ref], *[name] {text: concat(tag(rcn_ref), \" \", tag(name)); }").sheet(sheet)
Index: trunk/test/unit/org/openstreetmap/josm/gui/tagging/TaggingPresetReaderTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/gui/tagging/TaggingPresetReaderTest.java	(revision 7076)
+++ trunk/test/unit/org/openstreetmap/josm/gui/tagging/TaggingPresetReaderTest.java	(revision 7081)
@@ -13,5 +13,5 @@
 import org.junit.BeforeClass;
 import org.junit.Test;
-import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.JOSMFixture;
 import org.openstreetmap.josm.TestUtils;
 import org.openstreetmap.josm.tools.Utils;
@@ -28,5 +28,5 @@
     @BeforeClass
     public static void setUp() {
-        Main.initApplicationPreferences();
+        JOSMFixture.createUnitTestFixture().init();
     }
 
Index: trunk/test/unit/org/openstreetmap/josm/io/DiffResultProcessorTest.groovy
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/io/DiffResultProcessorTest.groovy	(revision 7076)
+++ trunk/test/unit/org/openstreetmap/josm/io/DiffResultProcessorTest.groovy	(revision 7081)
@@ -2,24 +2,24 @@
 package org.openstreetmap.josm.io;
 
+import static org.junit.Assert.*
 
-import org.junit.Test 
-import org.openstreetmap.josm.data.osm.Node;
-import org.openstreetmap.josm.data.osm.Way;
-import org.openstreetmap.josm.data.osm.Relation;
-import org.openstreetmap.josm.data.osm.Changeset;
+import org.junit.Test
 import org.openstreetmap.josm.data.coor.LatLon
-import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
-import org.openstreetmap.josm.data.osm.SimplePrimitiveId;
-import org.openstreetmap.josm.gui.progress.NullProgressMonitor;
-
-import static org.junit.Assert.*;
+import org.openstreetmap.josm.data.osm.Changeset
+import org.openstreetmap.josm.data.osm.Node
+import org.openstreetmap.josm.data.osm.OsmPrimitiveType
+import org.openstreetmap.josm.data.osm.Relation
+import org.openstreetmap.josm.data.osm.SimplePrimitiveId
+import org.openstreetmap.josm.data.osm.Way
+import org.openstreetmap.josm.gui.progress.NullProgressMonitor
+import org.openstreetmap.josm.tools.XmlParsingException
 
 class DiffResultProcessorTest {
-	
-	
+
+
 	@Test
 	public void testConstructor() {
 		Node n = new Node(1)
-		// these calls should not fail 
+		// these calls should not fail
 		//
 		def DiffResultProcessor processor  = new DiffResultProcessor(null)
@@ -27,25 +27,25 @@
 		processor  = new DiffResultProcessor([n])
 	}
-	
+
 	@Test
 	public void testParse_NOK_Cases() {
 		def DiffResultProcessor processor  = new DiffResultProcessor([])
-		
+
 		final shouldFail = new GroovyTestCase().&shouldFail
-		
+
 		shouldFail(IllegalArgumentException) {
 		    processor.parse null, NullProgressMonitor.INSTANCE
 		}
-		
-		shouldFail(OsmDataParsingException) {
+
+		shouldFail(XmlParsingException) {
 			processor.parse "", NullProgressMonitor.INSTANCE
 		}
-		
-		shouldFail(OsmDataParsingException) {
+
+		shouldFail(XmlParsingException) {
 			processor.parse "<x></x>", NullProgressMonitor.INSTANCE
-		}		
+		}
 	}
-	
-	@Test 
+
+	@Test
 	public void testParse_OK_Cases() {
 		def DiffResultProcessor processor  = new DiffResultProcessor([])
@@ -57,5 +57,5 @@
 		</diffResult>
 		"""
-		
+
 		processor.parse doc, null
 		assert processor.@diffResults.size() == 3
@@ -65,5 +65,5 @@
 		assert entry.new_id == 1
 		assert entry.new_version == 1
-		
+
 		id = new SimplePrimitiveId(-2, OsmPrimitiveType.WAY)
 		entry = processor.@diffResults[id]
@@ -71,12 +71,12 @@
 		assert entry.new_id == 2
 		assert entry.new_version == 1
-		
+
 		id = new SimplePrimitiveId(-3, OsmPrimitiveType.RELATION)
 		entry = processor.@diffResults[id]
 		assert entry != null
 		assert entry.new_id == 3
-		assert entry.new_version == 1		
+		assert entry.new_version == 1
 	}
-	
+
 	@Test
 	public void testPostProcess_Invocation_Variants() {
@@ -89,7 +89,7 @@
         </diffResult>
         """
-		
+
 		processor.parse doc, null
-		
+
 		// should all be ok
 		//
@@ -99,12 +99,12 @@
 		processor.postProcess new Changeset(1), NullProgressMonitor.INSTANCE
 	}
-	
+
 	@Test
 	public void testPostProcess_OK() {
-		
+
 		Node n = new Node()
 		Way w = new Way()
 		Relation r = new Relation()
-		
+
 		String doc = """\
 	        <diffResult version="0.6" generator="Test Data">
@@ -114,5 +114,5 @@
 	        </diffResult>
 	        """
-		
+
 		def DiffResultProcessor processor  = new DiffResultProcessor([n,w,r])
 		processor.parse doc, null
@@ -122,18 +122,18 @@
 		assert n.changesetId == 5
 		assert n.version == 10
-		
+
 		w = processed.find {it.uniqueId == 2}
 		assert w.changesetId == 5
 		assert w.version == 11
-		
+
 		r = processed.find {it.uniqueId == 3}
 		assert r.changesetId == 5
-		assert r.version == 12		
+		assert r.version == 12
 	}
-	
+
 	@Test
 	public void testPostProcess_ForCreatedElement() {
-		
-		Node n = new Node()		
+
+		Node n = new Node()
 		String doc = """\
             <diffResult version="0.6" generator="Test Data">
@@ -141,5 +141,5 @@
             </diffResult>
             """
-		
+
 		def DiffResultProcessor processor  = new DiffResultProcessor([n])
 		processor.parse doc, null
@@ -150,8 +150,8 @@
 		assert n.version == 1
 	}
-	
+
 	@Test
 	public void testPostProcess_ForModifiedElement() {
-		
+
 		Node n = new Node(1)
 		n.coor = new LatLon(1,1)
@@ -163,5 +163,5 @@
             </diffResult>
             """
-		
+
 		def DiffResultProcessor processor  = new DiffResultProcessor([n])
 		processor.parse doc, null
@@ -172,8 +172,8 @@
 		assert n.version == 3
 	}
-	
+
 	@Test
 	public void testPostProcess_ForDeletedElement() {
-		
+
 		Node n = new Node(1)
 		n.coor = new LatLon(1,1)
@@ -185,5 +185,5 @@
             </diffResult>
             """
-		
+
 		def DiffResultProcessor processor  = new DiffResultProcessor([n])
 		processor.parse doc, null
Index: trunk/test/unit/org/openstreetmap/josm/io/OsmChangeBuilderTest.groovy
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/io/OsmChangeBuilderTest.groovy	(revision 7076)
+++ trunk/test/unit/org/openstreetmap/josm/io/OsmChangeBuilderTest.groovy	(revision 7081)
@@ -1,32 +1,33 @@
 package org.openstreetmap.josm.io;
 
-import org.junit.Test 
-import org.openstreetmap.josm.data.coor.LatLon 
-import org.openstreetmap.josm.data.osm.Changeset 
-
-import static org.junit.Assert.*;
- 
+import static org.junit.Assert.*
+
+import org.junit.Test
+import org.openstreetmap.josm.data.coor.LatLon
+import org.openstreetmap.josm.data.osm.Changeset
+import org.openstreetmap.josm.data.osm.Node
+
 class OsmChangeBuilderTest {
-	
-	/**
-	 * Test various constructor invocations 
+
+	/**
+	 * Test various constructor invocations
 	 */
 	@Test
 	public void testConstructor() {
 		def Changeset cs = new Changeset(1)
-		// should not fail 
-		OsmChangeBuilder builder = new OsmChangeBuilder(cs)
-		
+		// should not fail
+		OsmChangeBuilder builder = new OsmChangeBuilder(cs)
+
 		// should not fail either - null allowed
 		builder = new OsmChangeBuilder(null)
-		
-		// should not fail 
+
+		// should not fail
 		builder = new OsmChangeBuilder(cs, "0.5")
-		
+
 		builder = new OsmChangeBuilder(cs, null)
-		
-		builder = new OsmChangeBuilder(null, null)      
-	}
-	
+
+		builder = new OsmChangeBuilder(null, null)
+	}
+
 	/**
 	 * Test the sequence of method calls. Should throw IllegalStateException if
@@ -35,47 +36,47 @@
 	@Test
 	public void testSequenceOfMethodCalls() {
-		def Changeset cs = new Changeset(1) 
-		OsmChangeBuilder builder = new OsmChangeBuilder(cs)
-		
+		def Changeset cs = new Changeset(1)
+		OsmChangeBuilder builder = new OsmChangeBuilder(cs)
+
 		final shouldFail = new GroovyTestCase().&shouldFail
-		
-		// should be OK 
+
+		// should be OK
 		builder.start()
 		Node n = new Node(new LatLon(0,0))
 		builder.append n
 		builder.finish()
-		
+
 		shouldFail(IllegalStateException) {
 			builder = new OsmChangeBuilder(cs)
 			builder.append n
 		}
-		
+
 		shouldFail(IllegalStateException) {
 			builder = new OsmChangeBuilder(cs)
 			builder.append([n])
 		}
-		
+
 		shouldFail(IllegalStateException) {
 			builder = new OsmChangeBuilder(cs)
 			builder.finish()
 		}
-		
+
 		shouldFail(IllegalStateException) {
 			builder = new OsmChangeBuilder(cs)
 			builder.start()
 			builder.start()
-		}       
-	}
-	
+		}
+	}
+
 	@Test
 	public void testDocumentWithNewNode() {
-		def Changeset cs = new Changeset(1) 
+		def Changeset cs = new Changeset(1)
 		OsmChangeBuilder builder = new OsmChangeBuilder(cs)
 		Node n = new Node(new LatLon(0,0))
-		
-		builder.start()
-		builder.append n
-		builder.finish()
-		
+
+		builder.start()
+		builder.append n
+		builder.finish()
+
 		def doc = new XmlParser().parseText(builder.document)
 		assert doc.@version == "0.6"
@@ -85,5 +86,5 @@
 		def create = doc.create
 		assert create != null
-		
+
 		assert create.size() == 1
 		def nodes = create[0].node
@@ -93,13 +94,13 @@
 		assert node.@lat != null
 		assert node.@lon != null
-		assert node.@changeset == cs.id.toString()      
-	}   
-	
-	/**
-	 * Test building a document with a modified node 
+		assert node.@changeset == cs.id.toString()
+	}
+
+	/**
+	 * Test building a document with a modified node
 	 */
 	@Test
 	public void testDocumentWithModifiedNode() {
-		def Changeset cs = new Changeset(1) 
+		def Changeset cs = new Changeset(1)
 		OsmChangeBuilder builder = new OsmChangeBuilder(cs)
 		Node n = new Node(1)
@@ -107,9 +108,9 @@
 		n.incomplete = false
 		n.modified = true
-		
-		builder.start()
-		builder.append n
-		builder.finish()
-		
+
+		builder.start()
+		builder.append n
+		builder.finish()
+
 		def doc = new XmlParser().parseText(builder.document)
 		assert doc.@version == "0.6"
@@ -119,5 +120,5 @@
 		def modify = doc.modify
 		assert modify != null
-		
+
 		assert modify.size() == 1
 		def nodes = modify[0].node
@@ -127,13 +128,13 @@
 		assert node.@lat != null
 		assert node.@lon != null
-		assert node.@changeset == cs.id.toString()      
-	}   
-	
-	/**
-	 * Test building a document with a deleted node 
+		assert node.@changeset == cs.id.toString()
+	}
+
+	/**
+	 * Test building a document with a deleted node
 	 */
 	@Test
 	public void testDocumentWithDeletedNode() {
-		def Changeset cs = new Changeset(1) 
+		def Changeset cs = new Changeset(1)
 		OsmChangeBuilder builder = new OsmChangeBuilder(cs)
 		Node n = new Node(1)
@@ -141,9 +142,9 @@
 		n.incomplete = false
 		n.deleted = true
-		
-		builder.start()
-		builder.append n
-		builder.finish()
-		
+
+		builder.start()
+		builder.append n
+		builder.finish()
+
 		def doc = new XmlParser().parseText(builder.document)
 		assert doc.@version == "0.6"
@@ -153,5 +154,5 @@
 		def delete = doc.delete
 		assert delete != null
-		
+
 		assert delete.size() == 1
 		def nodes = delete[0].node
@@ -159,16 +160,16 @@
 		def node = nodes[0]
 		assert node.@id == n.uniqueId.toString()
-		assert node.@lat != null
-		assert node.@lon != null
-		assert node.@changeset == cs.id.toString()      
-	}
-	
-	/**
-	 * Test building a mixed document. 
-	 *  
+		assert node.@lat == null
+		assert node.@lon == null
+		assert node.@changeset == cs.id.toString()
+	}
+
+	/**
+	 * Test building a mixed document.
+	 *
 	 */
 	@Test
 	public void testMixed() {
-		def Changeset cs = new Changeset(1) 
+		def Changeset cs = new Changeset(1)
 		OsmChangeBuilder builder = new OsmChangeBuilder(cs)
 		Node n1 = new Node(1)
@@ -176,31 +177,31 @@
 		n1.incomplete = false
 		n1.deleted = true
-		
+
 		Node n2 = new Node(new LatLon(0,0))
-		
+
 		Node n3 = new Node(2)
 		n3.coor = new LatLon(0,0)
 		n3.incomplete = false
 		n3.modified = true
-		
+
 		builder.start()
 		builder.append([n1,n2,n3])
 		builder.finish()
-		
-		def doc = new XmlParser().parseText(builder.document)
-		
+
+		def doc = new XmlParser().parseText(builder.document)
+
 		assert doc.children().size() == 3
 		assert doc.children()[0].name() == "delete"
 		assert doc.children()[1].name() == "create"
 		assert doc.children()[2].name() == "modify"
-		
+
 		def node = doc.children()[0].node[0]
 		assert node.@id == n1.uniqueId.toString()
-		
+
 		node = doc.children()[1].node[0]
 		assert node.@id == n2.uniqueId.toString()
-		
+
 		node = doc.children()[2].node[0]
-		assert node.@id == n3.uniqueId.toString()       
+		assert node.@id == n3.uniqueId.toString()
 	}
 }
Index: trunk/test/unit/org/openstreetmap/josm/io/ParseWithChangesetReaderTest.groovy
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/io/ParseWithChangesetReaderTest.groovy	(revision 7076)
+++ trunk/test/unit/org/openstreetmap/josm/io/ParseWithChangesetReaderTest.groovy	(revision 7081)
@@ -2,14 +2,22 @@
 package org.openstreetmap.josm.io;
 
-import org.junit.Test 
-
+import static org.junit.Assert.*
+
+import java.nio.charset.StandardCharsets
+
+import org.junit.Test
+import org.openstreetmap.josm.data.osm.DataSet
 import org.openstreetmap.josm.data.osm.Node
 import org.openstreetmap.josm.data.osm.OsmPrimitiveType
-import org.openstreetmap.josm.data.osm.DataSet
-
-import static org.junit.Assert.*;
 
 class ParseWithChangesetReaderTest {
-	
+
+    private DataSet getDataSet(String doc) {
+        InputStream is = new ByteArrayInputStream(doc.getBytes(StandardCharsets.UTF_8))
+        DataSet ds = new OsmReader().parseDataSet(is, null)
+        is.close()
+        return ds
+    }
+
 	/**
 	 * A new node with a changeset id. Ignore it.
@@ -19,16 +27,16 @@
 		String doc = """\
          <osm version="0.6">
-        <node id="-1" lat="0.0" lon="0.0" changeset="1"/>
-        </osm>
-        """
-		
-		OsmReader reader = new OsmReader()
-		DataSet ds = reader.parseDataSet(new StringBufferInputStream(doc), null)
-		Node n = ds.getPrimitiveById(-1, OsmPrimitiveType.NODE)
-		assert n != null
-		assert n.uniqueId == -1
-		assert n.changesetId == 0
-	}
-	
+        <node id="-1" lat="0.0" lon="0.0" changeset="1">
+            <tag k="external-id" v="-1"/>
+        </node>
+        </osm>
+        """
+
+		DataSet ds = getDataSet(doc)
+        Node n = ds.nodes.find {it.get("external-id") == "-1"}
+		assert n != null
+		assert n.changesetId == 0
+	}
+
 	/**
 	 * A new node with an invalid changeset id. Ignore it.
@@ -43,12 +51,11 @@
         </osm>
         """
-		
-		OsmReader reader = new OsmReader()
-		DataSet ds = reader.parseDataSet(new StringBufferInputStream(doc), null)
-		Node n = ds.nodes.find {it.get("external-id") == "-1"}
-		assert n != null
-		assert n.changesetId == 0
-	}
-	
+
+        DataSet ds = getDataSet(doc)
+		Node n = ds.nodes.find {it.get("external-id") == "-1"}
+		assert n != null
+		assert n.changesetId == 0
+	}
+
 	/**
 	 * A new node with an invalid changeset id. Ignore it.
@@ -63,12 +70,11 @@
         </osm>
         """
-		
-		OsmReader reader = new OsmReader()
-		DataSet ds = reader.parseDataSet(new StringBufferInputStream(doc), null)
-		Node n = ds.nodes.find {it.get("external-id") == "-1"}
-		assert n != null
-		assert n.changesetId == 0
-	}
-	
+
+        DataSet ds = getDataSet(doc)
+		Node n = ds.nodes.find {it.get("external-id") == "-1"}
+		assert n != null
+		assert n.changesetId == 0
+	}
+
 	/**
 	 * A new node with an invalid changeset id. Ignore it.
@@ -83,12 +89,11 @@
         </osm>
         """
-		
-		OsmReader reader = new OsmReader()
-		DataSet ds = reader.parseDataSet(new StringBufferInputStream(doc), null)
-		Node n = ds.nodes.find {it.get("external-id") == "-1"}
-		assert n != null
-		assert n.changesetId == 0
-	}
-	
+
+        DataSet ds = getDataSet(doc)
+		Node n = ds.nodes.find {it.get("external-id") == "-1"}
+		assert n != null
+		assert n.changesetId == 0
+	}
+
 	/**
 	 * A new node with a missing changeset id. That's fine. The changeset id
@@ -104,13 +109,12 @@
         </osm>
         """
-		
-		OsmReader reader = new OsmReader()
-		DataSet ds = reader.parseDataSet(new StringBufferInputStream(doc), null)
-		Node n = ds.nodes.find {it.get("external-id") == "-1"}
-		assert n != null
-		assert n.changesetId == 0
-	}
-	
-	
+
+        DataSet ds = getDataSet(doc)
+		Node n = ds.nodes.find {it.get("external-id") == "-1"}
+		assert n != null
+		assert n.changesetId == 0
+	}
+
+
 	/**
 	 * An existing node with a missing changeset id. That's fine. The changeset id
@@ -124,7 +128,6 @@
         </osm>
         """
-		
-		OsmReader reader = new OsmReader()
-		DataSet ds = reader.parseDataSet(new StringBufferInputStream(doc), null)
+
+        DataSet ds = getDataSet(doc)
 		Node n = ds.getPrimitiveById(1, OsmPrimitiveType.NODE)
 		assert n != null
@@ -132,5 +135,5 @@
 		assert n.changesetId == 0
 	}
-	
+
 	/**
      * An existing node with a valid changeset id id. That's fine. The changeset id
@@ -144,7 +147,6 @@
         </osm>
         """
-		
-		OsmReader reader = new OsmReader()
-		DataSet ds = reader.parseDataSet(new StringBufferInputStream(doc), null)
+
+        DataSet ds = getDataSet(doc)
 		Node n = ds.getPrimitiveById(1, OsmPrimitiveType.NODE)
 		assert n != null
@@ -152,5 +154,5 @@
 		assert n.changesetId == 4
 	}
-	
+
 	/**
 	 * An existing node with an invalid changeset id. That's a problem. An exception
@@ -164,12 +166,11 @@
         </osm>
         """
-		
+
 		final shouldFail = new GroovyTestCase().&shouldFail
-		
-		OsmReader reader = new OsmReader()
+
 		shouldFail(IllegalDataException) {
-		    DataSet ds = reader.parseDataSet(new StringBufferInputStream(doc), null)
+            DataSet ds = getDataSet(doc)
 		}
-	}	
+	}
 	/**
 	 * An existing node with an invalid changeset id. That's a problem. An exception
@@ -183,12 +184,11 @@
         </osm>
         """
-		
+
 		final shouldFail = new GroovyTestCase().&shouldFail
-		
-		OsmReader reader = new OsmReader()
+
 		shouldFail(IllegalDataException) {
-			DataSet ds = reader.parseDataSet(new StringBufferInputStream(doc), null)
+            DataSet ds = getDataSet(doc)
 		}
-	}   
+	}
 	/**
 	 * An existing node with an invalid changeset id. That's a problem. An exception
@@ -202,11 +202,10 @@
 	        </osm>
 	        """
-		
+
 		final shouldFail = new GroovyTestCase().&shouldFail
-		
-		OsmReader reader = new OsmReader()
+
 		shouldFail(IllegalDataException) {
-			DataSet ds = reader.parseDataSet(new StringBufferInputStream(doc), null)
+            DataSet ds = getDataSet(doc)
 		}
-	}   
+	}
 }
Index: trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/RemoteControlTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/RemoteControlTest.java	(revision 7076)
+++ trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/RemoteControlTest.java	(revision 7081)
@@ -26,4 +26,5 @@
 import org.junit.Before;
 import org.junit.Test;
+import org.openstreetmap.josm.JOSMFixture;
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.tools.Utils;
@@ -36,5 +37,5 @@
     private String httpBase;
     private String httpsBase;
-    
+
     /**
      * Starts Remote control before testing requests.
@@ -42,5 +43,5 @@
     @Before
     public void setUp() {
-        Main.initApplicationPreferences();
+        JOSMFixture.createUnitTestFixture().init();
         RemoteControl.start();
         disableCertificateValidation();
@@ -48,7 +49,7 @@
         httpsBase = "https://127.0.0.1:"+Main.pref.getInteger("remote.control.https.port", 8112);
     }
-    
+
     /**
-     * Disable all HTTPS validation mechanisms as described 
+     * Disable all HTTPS validation mechanisms as described
      * <a href="http://stackoverflow.com/a/2893932/2257172">here</a> and
      * <a href="http://stackoverflow.com/a/19542614/2257172">here</a>
@@ -56,5 +57,5 @@
     public void disableCertificateValidation() {
         // Create a trust manager that does not validate certificate chains
-        TrustManager[] trustAllCerts = new TrustManager[] { 
+        TrustManager[] trustAllCerts = new TrustManager[] {
             new X509TrustManager() {
                 public X509Certificate[] getAcceptedIssuers() {
@@ -76,5 +77,5 @@
             fail(e.getMessage());
         }
-        
+
         // Create all-trusting host name verifier
         HostnameVerifier allHostsValid = new HostnameVerifier() {
@@ -100,5 +101,5 @@
      * Tests that sending an HTTP request without command results in HTTP 400, with all available commands in error message.
      * @throws IOException if an I/O error occurs
-     * @throws MalformedURLException if HTTP URL is invalid  
+     * @throws MalformedURLException if HTTP URL is invalid
      */
     @Test
@@ -110,5 +111,5 @@
      * Tests that sending an HTTPS request without command results in HTTP 400, with all available commands in error message.
      * @throws IOException if an I/O error occurs
-     * @throws MalformedURLException if HTTPS URL is invalid  
+     * @throws MalformedURLException if HTTPS URL is invalid
      */
     @Test
@@ -122,5 +123,5 @@
         assertEquals(connection.getResponseCode(), HttpURLConnection.HTTP_BAD_REQUEST);
         try (InputStream is = connection.getErrorStream()) {
-            // TODO this code should be refactored somewhere in Utils as it is used in several JOSM classes 
+            // TODO this code should be refactored somewhere in Utils as it is used in several JOSM classes
             StringBuilder responseBody = new StringBuilder();
             try (BufferedReader in = new BufferedReader(new InputStreamReader(is, Utils.UTF_8))) {
Index: trunk/test/unit/org/openstreetmap/josm/io/session/SessionWriterTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/io/session/SessionWriterTest.java	(revision 7076)
+++ trunk/test/unit/org/openstreetmap/josm/io/session/SessionWriterTest.java	(revision 7081)
@@ -11,4 +11,5 @@
 import org.junit.BeforeClass;
 import org.junit.Test;
+import org.openstreetmap.josm.JOSMFixture;
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.data.gpx.GpxData;
@@ -74,6 +75,5 @@
     @BeforeClass
     public static void setUpBeforeClass() {
-        Main.initApplicationPreferences();
-        Main.determinePlatformHook();
+        JOSMFixture.createUnitTestFixture().init();
         ProjectionPreference.setProjection();
         Main.toolbar = new ToolbarPreferences();
Index: trunk/test/unit/org/openstreetmap/josm/tools/BugReportExceptionHandlerTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/tools/BugReportExceptionHandlerTest.java	(revision 7076)
+++ trunk/test/unit/org/openstreetmap/josm/tools/BugReportExceptionHandlerTest.java	(revision 7081)
@@ -13,4 +13,5 @@
 import org.junit.Before;
 import org.junit.Test;
+import org.openstreetmap.josm.JOSMFixture;
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.actions.ShowStatusReportAction;
@@ -27,11 +28,10 @@
     public void setUp() {
         Main.commandLineArgs = new String[0];
-        Main.determinePlatformHook();
-        Main.initApplicationPreferences();
+        JOSMFixture.createUnitTestFixture().init();
     }
 
     /**
      * Test method for {@link org.openstreetmap.josm.tools.BugReportExceptionHandler#getBugReportUrl(java.lang.String)}.
-     * @throws IOException 
+     * @throws IOException
      */
     @Test
@@ -41,5 +41,5 @@
         String prefix = Main.getJOSMWebsite()+"/josmticket?gdata=";
         assertTrue(url.startsWith(prefix));
-        
+
         String gdata = url.substring(prefix.length());
         // JAXB only provides support for "base64" decoding while we encode url in "base64url", so switch encoding, only for test purpose
Index: trunk/test/unit/org/openstreetmap/josm/tools/TextTagParserTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/tools/TextTagParserTest.java	(revision 7076)
+++ trunk/test/unit/org/openstreetmap/josm/tools/TextTagParserTest.java	(revision 7081)
@@ -9,5 +9,5 @@
 import org.junit.BeforeClass;
 import org.junit.Test;
-import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.JOSMFixture;
 
 public class TextTagParserTest {
@@ -18,5 +18,5 @@
     @BeforeClass
     public static void setUp() {
-        Main.initApplicationPreferences();
+        JOSMFixture.createUnitTestFixture().init();
     }
 
Index: trunk/test/unit/org/openstreetmap/josm/tools/template_engine/TemplateEngineTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/tools/template_engine/TemplateEngineTest.java	(revision 7076)
+++ trunk/test/unit/org/openstreetmap/josm/tools/template_engine/TemplateEngineTest.java	(revision 7081)
@@ -8,5 +8,5 @@
 import org.junit.BeforeClass;
 import org.junit.Test;
-import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.JOSMFixture;
 import org.openstreetmap.josm.actions.search.SearchCompiler;
 import org.openstreetmap.josm.actions.search.SearchCompiler.Match;
@@ -24,5 +24,5 @@
     @BeforeClass
     public static void setUp() {
-        Main.initApplicationPreferences();
+        JOSMFixture.createUnitTestFixture().init();
     }
 
