Index: trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionRefTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionRefTest.java	(revision 5073)
+++ trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionRefTest.java	(revision 5236)
@@ -12,4 +12,5 @@
 import java.util.LinkedHashMap;
 import java.util.List;
+import java.util.Map;
 import java.util.Map.Entry;
 
@@ -17,4 +18,6 @@
 import org.openstreetmap.josm.data.coor.EastNorth;
 import org.openstreetmap.josm.data.coor.LatLon;
+import org.openstreetmap.josm.gui.preferences.projection.ProjectionChoice;
+import org.openstreetmap.josm.gui.preferences.projection.ProjectionPreference;
 import org.openstreetmap.josm.tools.Utils;
 
@@ -29,20 +32,15 @@
 
     /**
-     * create a list of epsg codes and bounds to be used by
+     * create a list of epsg codes and bounds to be used by the perl script
      * @param args
      */
     public static void main(String[] args) {
-        HashMap<String, Projection> allCodes = new LinkedHashMap<String, Projection>();
-        List<Projection> projs = Projections.getProjections();
-        for (Projection p: projs) {
-            if (p instanceof ProjectionSubPrefs) {
-                for (String code : ((ProjectionSubPrefs)p).allCodes()) {
-                    ProjectionSubPrefs projSub = recreateProj((ProjectionSubPrefs)p);
-                    Collection<String> prefs = projSub.getPreferencesFromCode(code);
-                    projSub.setPreferences(prefs);
-                    allCodes.put(code, projSub);
-                }
-            } else {
-                allCodes.put(p.toCode(), p);
+        Map<String, Projection> allCodes = new HashMap<String, Projection>();
+        for (ProjectionChoice pc : ProjectionPreference.getProjectionChoices()) {
+            for (String code : pc.allCodes()) {
+                Collection<String> pref = pc.getPreferencesFromCode(code);
+                pc.setPreferences(pref);
+                Projection p = pc.getProjection();
+                allCodes.put(code, p);
             }
         }
@@ -51,14 +49,5 @@
         }
     }
-
-    private static ProjectionSubPrefs recreateProj(ProjectionSubPrefs proj) {
-        try {
-            return proj.getClass().newInstance();
-        } catch (Exception e) {
-            throw new IllegalStateException(
-                    tr("Cannot instantiate projection ''{0}''", proj.getClass().toString()), e);
-        }
-    }
-
+ 
     @Test
     public void test() throws IOException, FileNotFoundException {
Index: trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionRegressionTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionRegressionTest.java	(revision 5073)
+++ trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionRegressionTest.java	(revision 5236)
@@ -2,5 +2,4 @@
 package org.openstreetmap.josm.data.projection;
 
-import static org.openstreetmap.josm.tools.I18n.tr;
 
 import java.io.BufferedReader;
@@ -12,10 +11,8 @@
 import java.io.IOException;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
-import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Map;
@@ -31,5 +28,6 @@
 import org.openstreetmap.josm.data.coor.EastNorth;
 import org.openstreetmap.josm.data.coor.LatLon;
-import org.openstreetmap.josm.tools.Utils;
+import org.openstreetmap.josm.gui.preferences.projection.ProjectionChoice;
+import org.openstreetmap.josm.gui.preferences.projection.ProjectionPreference;
 import org.openstreetmap.josm.tools.Pair;
 
@@ -58,16 +56,12 @@
     public static void main(String[] args) throws IOException, FileNotFoundException {
         setUp();
-        Map<String, Projection> allCodes = new LinkedHashMap<String, Projection>();
-        List<Projection> projs = Projections.getProjections();
-        for (Projection p: projs) {
-            if (p instanceof ProjectionSubPrefs) {
-                for (String code : ((ProjectionSubPrefs)p).allCodes()) {
-                    ProjectionSubPrefs projSub = recreateProj((ProjectionSubPrefs)p);
-                    Collection<String> prefs = projSub.getPreferencesFromCode(code);
-                    projSub.setPreferences(prefs);
-                    allCodes.put(code, projSub);
-                }
-            } else {
-                allCodes.put(p.toCode(), p);
+
+        Map<String, Projection> supportedCodesMap = new HashMap<String, Projection>();
+        for (ProjectionChoice pc : ProjectionPreference.getProjectionChoices()) {
+            for (String code : pc.allCodes()) {
+                Collection<String> pref = pc.getPreferencesFromCode(code);
+                pc.setPreferences(pref);
+                Projection p = pc.getProjection();
+                supportedCodesMap.put(code, p);
             }
         }
@@ -77,7 +71,19 @@
             prevData = readData();
         }
-        Map<String,TestData> prevCodes = new HashMap<String,TestData>();
+        Map<String,TestData> prevCodesMap = new HashMap<String,TestData>();
         for (TestData data : prevData) {
-            prevCodes.put(data.code, data);
+            prevCodesMap.put(data.code, data);
+        }
+
+        Set<String> codesToWrite = new LinkedHashSet<String>();
+        for (TestData data : prevData) {
+            if (supportedCodesMap.containsKey(data.code)) {
+                codesToWrite.add(data.code);
+            }
+        }
+        for (String code : supportedCodesMap.keySet()) {
+            if (!codesToWrite.contains(code)) {
+                codesToWrite.add(code);
+            }
         }
 
@@ -86,9 +92,11 @@
         out.write("# Data for test/unit/org/openstreetmap/josm/data/projection/ProjectionRegressionTest.java\n");
         out.write("# Format: 1. Projection code; 2. lat/lon; 3. lat/lon projected -> east/north; 4. east/north (3.) inverse projected\n");
-        for (Entry<String, Projection> e : allCodes.entrySet()) {
-            Projection proj = e.getValue();
+        for (Entry<String, Projection> e : supportedCodesMap.entrySet()) {
+        }
+        for (String code : codesToWrite) {
+            Projection proj = supportedCodesMap.get(code);
             Bounds b = proj.getWorldBoundsLatLon();
             double lat, lon;
-            TestData prev = prevCodes.get(proj.toCode());
+            TestData prev = prevCodesMap.get(proj.toCode());
             if (prev != null) {
                 lat = prev.ll.lat();
@@ -103,13 +111,4 @@
         }
         out.close();
-    }
-
-    private static ProjectionSubPrefs recreateProj(ProjectionSubPrefs proj) {
-        try {
-            return proj.getClass().newInstance();
-        } catch (Exception e) {
-            throw new IllegalStateException(
-                    tr("Cannot instantiate projection ''{0}''", proj.getClass().toString()), e);
-        }
     }
 
@@ -163,13 +162,6 @@
         StringBuilder fail = new StringBuilder();
 
-        List<Projection> projs = Projections.getProjections();
-        for (Projection p: projs) {
-            Collection<String> codes = null;
-            if (p instanceof ProjectionSubPrefs) {
-                codes = Arrays.asList(((ProjectionSubPrefs)p).allCodes());
-            } else {
-                codes = Collections.singleton(p.toCode());
-            }
-            for (String code : codes) {
+        for (ProjectionChoice pc : ProjectionPreference.getProjectionChoices()) {
+            for (String code : pc.allCodes()) {
                if (!dataCodes.contains(code)) {
                     fail.append("Did not find projection "+code+" in test data!\n");
Index: trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionTest.java	(revision 5073)
+++ trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionTest.java	(revision 5236)
@@ -2,5 +2,4 @@
 package org.openstreetmap.josm.data.projection;
 
-import java.util.Collections;
 import java.util.Random;
 
@@ -30,45 +29,35 @@
         }
 
-        Lambert lam = new Lambert();
-        for (int zone=1; zone<=4; ++zone) {
-            lam.setPreferences(Collections.singletonList(Integer.toString(zone)));
-            testProj(lam);
+        for (int i=0; i<=3; ++i) {
+            testProj(new Lambert(i));
         }
 
-        Puwg puwg = new Puwg();
-        for (PuwgData pd : Puwg.Zones) {
-            puwg.setPreferences(Collections.singletonList(pd.toCode()));
-            testProj(puwg);
+        for (int i=0; i<=4; ++i) {
+            testProj(new Puwg(i));
         }
 
         testProj(new SwissGrid());
 
-        UTM utm = new UTM();
         for (int i=0; i<=6; ++i) {
             int zone;
             if (i==0) {
-                zone = 0;
+                zone = 1;
             } else if (i==6) {
-                zone = 59;
+                zone = 60;
             } else {
-                zone = rand.nextInt(60);
+                zone = rand.nextInt(60) + 1;
             }
-            utm.setPreferences(Collections.singletonList(Integer.toString(zone)));
-            testProj(utm);
-
+            UTM.Hemisphere hem = rand.nextBoolean() ? UTM.Hemisphere.North : UTM.Hemisphere.South;
+            testProj(new UTM(zone, hem));
         }
 
         if (!"yes".equals(System.getProperty("suppressPermanentFailure"))) {
-            UTM_France_DOM utmFr = new UTM_France_DOM();
-            for (int zone=1; zone<=5; ++zone) {
-                utmFr.setPreferences(Collections.singletonList(Integer.toString(zone)));
-                testProj(utmFr);
+            for (int i=0; i<=4; ++i) {
+                testProj(new UTM_France_DOM(i));
             }
         }
 
-        LambertCC9Zones lamCC9 = new LambertCC9Zones();
-        for (int i=1; i<=9; ++i) {
-            lamCC9.setPreferences(Collections.singletonList(Integer.toString(i)));
-            testProj(lamCC9);
+        for (int i=0; i<=8; ++i) {
+            testProj(new LambertCC9Zones(i));
         }
 
