Changeset 10850 in josm for trunk/test/unit/org


Ignore:
Timestamp:
2016-08-19T01:16:51+02:00 (8 years ago)
Author:
Don-vip
Message:

fix #13344 - Unable to run unit tests in Eclipse

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/JOSMFixture.java

    r10510 r10850  
    101101        Main.logLevel = 3;
    102102        Main.pref.init(false);
     103        String url = Main.pref.get("osm-server.url");
     104        if (url == null || url.isEmpty() || isProductionApiUrl(url)) {
     105            Main.pref.put("osm-server.url", "http://api06.dev.openstreetmap.org/api");
     106        }
    103107        I18n.set(Main.pref.get("language", "en"));
    104108
     
    113117
    114118        // make sure we don't upload to or test against production
    115         //
    116         String url = OsmApi.getOsmApi().getBaseUrl().toLowerCase(Locale.ENGLISH).trim();
    117         if (url.startsWith("http://www.openstreetmap.org") || url.startsWith("http://api.openstreetmap.org")
    118             || url.startsWith("https://www.openstreetmap.org") || url.startsWith("https://api.openstreetmap.org")) {
     119        url = OsmApi.getOsmApi().getBaseUrl().toLowerCase(Locale.ENGLISH).trim();
     120        if (isProductionApiUrl(url)) {
    119121            fail(MessageFormat.format("configured server url ''{0}'' seems to be a productive url, aborting.", url));
    120122        }
     
    128130            });
    129131        }
     132    }
     133
     134    private static boolean isProductionApiUrl(String url) {
     135        return url.startsWith("http://www.openstreetmap.org") || url.startsWith("http://api.openstreetmap.org")
     136            || url.startsWith("https://www.openstreetmap.org") || url.startsWith("https://api.openstreetmap.org");
    130137    }
    131138
Note: See TracChangeset for help on using the changeset viewer.