Index: /trunk/.classpath
===================================================================
--- /trunk/.classpath	(revision 12556)
+++ /trunk/.classpath	(revision 12557)
@@ -22,4 +22,5 @@
 	<classpathentry kind="lib" path="test/lib/unitils-core/unitils-core-3.4.6.jar"/>
 	<classpathentry kind="lib" path="test/lib/commons-testing/commons-testing-2.1.0.jar"/>
+	<classpathentry kind="lib" path="test/lib/wiremock-standalone-2.7.1.jar"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
 	<classpathentry exported="true" kind="con" path="GROOVY_SUPPORT"/>
Index: /trunk/netbeans/nbproject/project.properties
===================================================================
--- /trunk/netbeans/nbproject/project.properties	(revision 12556)
+++ /trunk/netbeans/nbproject/project.properties	(revision 12557)
@@ -58,4 +58,5 @@
 file.reference.unitils-core-3.4.6.jar=../test/lib/unitils-core/unitils-core-3.4.6.jar
 file.reference.system-rules-1.16.1.jar=../test/lib/system-rules-1.16.1.jar
+file.reference.wiremock-standalone-2.7.1.jar=../test/lib/wiremock-standalone-2.7.1.jar
 includes=**/*.java
 jar.compress=false
@@ -91,4 +92,5 @@
     ${file.reference.unitils-core-3.4.6.jar}:\
     ${file.reference.system-rules-1.16.1.jar}:\
+    ${file.reference.wiremock-standalone-2.7.1.jar}:\
     ${file.reference.findbugs.jar}:\
     ${file.reference.commons-testing-2.1.0.jar}
Index: /trunk/src/org/openstreetmap/josm/io/NameFinder.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/io/NameFinder.java	(revision 12556)
+++ /trunk/src/org/openstreetmap/josm/io/NameFinder.java	(revision 12557)
@@ -18,5 +18,7 @@
 import org.openstreetmap.josm.data.osm.PrimitiveId;
 import org.openstreetmap.josm.data.osm.SimplePrimitiveId;
+import org.openstreetmap.josm.data.preferences.StringProperty;
 import org.openstreetmap.josm.tools.HttpClient;
+import org.openstreetmap.josm.tools.HttpClient.Response;
 import org.openstreetmap.josm.tools.OsmUrlToBounds;
 import org.openstreetmap.josm.tools.UncheckedParseException;
@@ -34,7 +36,13 @@
 
     /**
-     * Nominatim URL.
+     * Nominatim default URL.
      */
     public static final String NOMINATIM_URL = "https://nominatim.openstreetmap.org/search?format=xml&q=";
+
+    /**
+     * Nominatim URL property.
+     * @since xxx
+     */
+    public static final StringProperty NOMINATIM_URL_PROP = new StringProperty("nominatim-url", NOMINATIM_URL);
 
     private NameFinder() {
@@ -48,5 +56,5 @@
      */
     public static List<SearchResult> queryNominatim(final String searchExpression) throws IOException {
-        return query(new URL(NOMINATIM_URL + Utils.encodeUrl(searchExpression)));
+        return query(new URL(NOMINATIM_URL_PROP.get() + Utils.encodeUrl(searchExpression)));
     }
 
@@ -59,6 +67,9 @@
     public static List<SearchResult> query(final URL url) throws IOException {
         final HttpClient connection = HttpClient.create(url);
-        connection.connect();
-        try (Reader reader = connection.getResponse().getContentReader()) {
+        Response response = connection.connect();
+        if (response.getResponseCode() >= 400) {
+            throw new IOException(response.getResponseMessage() + ": " + response.fetchContent());
+        }
+        try (Reader reader = response.getContentReader()) {
             return parseSearchResults(reader);
         } catch (ParserConfigurationException | SAXException ex) {
Index: /trunk/src/org/openstreetmap/josm/io/imagery/WMSImagery.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/io/imagery/WMSImagery.java	(revision 12556)
+++ /trunk/src/org/openstreetmap/josm/io/imagery/WMSImagery.java	(revision 12557)
@@ -30,4 +30,5 @@
 import org.openstreetmap.josm.data.projection.Projections;
 import org.openstreetmap.josm.tools.HttpClient;
+import org.openstreetmap.josm.tools.HttpClient.Response;
 import org.openstreetmap.josm.tools.Utils;
 import org.w3c.dom.Document;
@@ -226,7 +227,12 @@
         }
 
-        final String incomingData = HttpClient.create(getCapabilitiesUrl).connect().fetchContent();
+        final Response response = HttpClient.create(getCapabilitiesUrl).connect();
+        final String incomingData = response.fetchContent();
         Main.debug("Server response to Capabilities request:");
         Main.debug(incomingData);
+
+        if (response.getResponseCode() >= 400) {
+            throw new WMSGetCapabilitiesException(response.getResponseMessage(), incomingData);
+        }
 
         try {
Index: /trunk/test/data/__files/README
===================================================================
--- /trunk/test/data/__files/README	(revision 12557)
+++ /trunk/test/data/__files/README	(revision 12557)
@@ -0,0 +1,1 @@
+The __files directory must be named this way in order to use WireMock, until https://github.com/tomakehurst/wiremock/issues/471 is fixed.
Index: /trunk/test/data/__files/imagery/maps.xml
===================================================================
--- /trunk/test/data/__files/imagery/maps.xml	(revision 12557)
+++ /trunk/test/data/__files/imagery/maps.xml	(revision 12557)
@@ -0,0 +1,92 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<imagery xmlns="http://josm.openstreetmap.de/maps-1.0">
+	<entry>
+		<name>Landsat</name>
+		<id>landsat</id>
+		<type>wms</type>
+		<url><![CDATA[http://irs.gis-lab.info/?layers=landsat&SRS={proj}&WIDTH={width}&HEIGHT={height}&BBOX={bbox}]]></url>
+		<icon>data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAgMAAABinRfyAAAADFBMVEUTPmdaXSdnXUmdcyo9AbYLAAAAFklEQVQI12NYtYqBgYEI4v//0FAiCAA8TB/hMzHkwAAAAABJRU5ErkJggg==
+		</icon>
+		<projections>
+			<code>NASA:4326</code>
+			<code>EPSG:32641</code>
+			<code>EPSG:3857</code>
+			<code>EPSG:3785</code>
+			<code>EPSG:32642</code>
+			<code>EPSG:32640</code>
+			<code>EPSG:4326</code>
+			<code>EPSG:900913</code>
+			<code>EPSG:3395</code>
+			<code>EPSG:32639</code>
+			<code>EPSG:32638</code>
+			<code>EPSG:32637</code>
+			<code>EPSG:32636</code>
+			<code>EPSG:32635</code>
+		</projections>
+	</entry>
+	<entry>
+		<name>Bing aerial imagery</name>
+		<id>Bing</id>
+		<type>bing</type>
+		<default>true</default>
+		<url>http://www.bing.com/maps/</url>
+		<max-zoom>22</max-zoom>
+		<permission-ref>http://wiki.openstreetmap.org/wiki/Bing_Maps
+		</permission-ref>
+		<icon>data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgBAMAAACBVGfHAAAALVBMVEUMhIT///8jj4/Z7Ozl8vJUqal/vr6+3t6Tycmo1NQxl5dutbXz+flBn5/M5eX9gIKtAAAAjUlEQVR4XmMgD6gFoQkoC7eiCQgKK6AJiNBEQGkBmoBW5S40LROFZyugCMQICloEIQuoCwoKCicgCbAJCgoKGiEJMCWjCTAwpaAJsBaiCnC1CCILCCslCwoKijQgVKQLCgoKliLcAQbWCqgCFgin6wkKCgqevIDwHO8cQUHxAAYkwFoonMSAArS7GCgAAKZlGg8L4DPrAAAAAElFTkSuQmCC
+		</icon>
+		<no-tile-header name="X-VE-Tile-Info" value="no-tile" />
+		<metadata-header header-name="X-VE-TILEMETA-CaptureDatesRange"
+			metadata-key="Capture Date" />
+	</entry>
+	<entry>
+		<name>Mapbox Satellite</name>
+		<id>Mapbox</id>
+		<default>true</default>
+		<type>tms</type>
+		<attribution-text mandatory="true">Terms &amp; Feedback
+		</attribution-text>
+		<attribution-url>http://www.mapbox.com/about/maps/</attribution-url>
+		<url>https://{switch:a,b,c}.tiles.mapbox.com/v4/openstreetmap.map-inh7ifmo/{zoom}/{x}/{y}.png?access_token=pk.eyJ1Ijoib3BlbnN0cmVldG1hcCIsImEiOiJncjlmd0t3In0.DmZsIeOW-3x-C5eX-wAqTw
+		</url>
+		<max-zoom>19</max-zoom>
+		<icon>data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAAhFBMVEVHcEz///9CZPtphPtFZ/uMof1KavvO0uJifvtQcPuLn/1ng/ve4euQnv36+vtIaPtXdfvt7vTr7PG2v+jl5/BaePuhrv1devugrOC7wNdxi/uap96uuOXKzeDc3/O9xuqfrfzY2+ilsOLEy+xEZfuQntuwttG+w9mpsM2Zp/x3j/t0jfvA+Y0kAAAAAXRSTlMAQObYZgAAASRJREFUeF6Fk+eSwyAMhC2Be+9Ob9fv/d/viBQgDLnx98cedi2JNQTPhHkqZSrC4CVZjYYo8+SzRAdZunqCHsmznuILUk/3HX79fPmMN7vE7XK2n5yAuTVI8KRm/qYATSd4L7R/rddH0i4VObjGPY9IGxYgfvbchRNTBq2PFQkxzvzCk6r8teFKy+0WcSHHjlbDIEdGtne5pIbzXlk2tCxMSFtQ9DMSvxeAwyOsN2RK6lD1jfLGALpCbQwfwPQYtWBnkKZFDEw1TkDkjxYCGZNi39HjhIQw2xzAoXhUDk1QnaMfG2RUkrVuYakWXuSoMzsk015H1GT2d7/HxTAUh69J8Mbt7w6+8V9K58j5JGuHdv3Yr18cy7Ry9RRZ5F1ej1D41/8P1QwO53k2L5oAAAAASUVORK5CYII=
+		</icon>
+		<permission-ref>http://wiki.openstreetmap.org/wiki/Vertical_Aerial_Photographs#DigitalGlobe_.2F_MapBox
+		</permission-ref>
+		<no-tile-header name="ETag"
+			value="&quot;067736a547cafe90014b4e59b6510abe&quot;|&quot;ee1f6802b0234046b553cbbc672ac7d9&quot;|&quot;9f5a2f1d7cc131e58befc2052c71c827&quot;" />
+		<no-tile-checksum type="MD5"
+			value="811bb5f56a0e672f674a2a820d340c61" />
+	</entry>
+	<entry>
+		<name>IGN orthophoto AMBA a (WMTS)</name>
+		<id>ign-amba-a</id>
+		<type>wmts</type>
+		<url>
+<![CDATA[
+https://ide.ign.gob.ar/geoservicios/rest/services/sensores_remotos/amba_a/ImageServer/WMTS?
+]]>
+		</url>
+		<permission-ref>http://www.ign.gob.ar/descargas/tyc1.html
+		</permission-ref>
+		<projections>
+			<code>CRS:84</code>
+			<code>EPSG:4326</code>
+			<code>EPSG:3857</code>
+			<code>EPSG:102100</code>
+		</projections>
+		<country-code>AR</country-code>
+		<bounds min-lat="-34.668416" min-lon="-59.251080" max-lat="-34.331591"
+			max-lon="-58.498165" />
+		<attribution-text>
+			Instituto Geográfico Nacional de la República Argentina
+		</attribution-text>
+		<attribution-url>http://www.ign.gob.ar</attribution-url>
+		<icon>
+			http://www.ign.gob.ar/sites/default/files/favicon.png
+		</icon>
+		<min-zoom>1</min-zoom>
+		<max-zoom>20</max-zoom>
+	</entry>
+</imagery>
Index: /trunk/test/data/__files/imagery/wms-capabilities.xml
===================================================================
--- /trunk/test/data/__files/imagery/wms-capabilities.xml	(revision 12557)
+++ /trunk/test/data/__files/imagery/wms-capabilities.xml	(revision 12557)
@@ -0,0 +1,122 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<WMS_Capabilities version="1.3.0"
+  xmlns="http://www.opengis.net/wms"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xmlns:esri_wms="http://www.esri.com/wms"
+  xsi:schemaLocation="http://www.opengis.net/wms http://schemas.opengis.net/wms/1.3.0/capabilities_1_3_0.xsd http://www.esri.com/wms http://maps.six.nsw.gov.au/arcgis/services/public/NSW_Imagery/MapServer/WmsServer?version=1.3.0%26service=WMS%26request=GetSchemaExtension">
+  <Service>
+    <Name><![CDATA[WMS]]></Name>
+    <Title>WMS</Title>
+    <Abstract><![CDATA[Progressively from scales larger than 1:150,000 higher resolution imagery overlays lower resolution imagery and most recent imagery overlays older imagery within each resolution.
+This service includes external imagery sourced from © AAM 2011,2012; © Jacobs Group Ausimage 2002,2006,2009,2014; © LANDSAT 2014
+Metadata_link http://sdi.nsw.gov.au/catalog/search/resource/details.page?uuid=%7BA9550CB1-5908-4A47-936F-64AE50405DF7%7D]]></Abstract>
+    <KeywordList><Keyword><![CDATA[]]></Keyword></KeywordList>
+    <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="http://maps.six.nsw.gov.au/arcgis/services/public/NSW_Imagery/MapServer/WmsServer?"/>
+    <ContactInformation>
+      <ContactPersonPrimary>
+        <ContactPerson><![CDATA[]]></ContactPerson>
+        <ContactOrganization><![CDATA[Land and Property Information NSW]]></ContactOrganization>
+      </ContactPersonPrimary>
+      <ContactPosition><![CDATA[Manager Spatial Data Services]]></ContactPosition>
+      <ContactAddress>
+        <AddressType><![CDATA[]]></AddressType>
+        <Address><![CDATA[346 Panorama Avenue]]></Address>
+        <City><![CDATA[Bathurst]]></City>
+        <StateOrProvince><![CDATA[NSW]]></StateOrProvince>
+        <PostCode><![CDATA[2795]]></PostCode>
+        <Country><![CDATA[Australia]]></Country>
+      </ContactAddress>
+      <ContactVoiceTelephone><![CDATA[02 63328200]]></ContactVoiceTelephone>
+      <ContactFacsimileTelephone><![CDATA[02 63328296]]></ContactFacsimileTelephone>
+      <ContactElectronicMailAddress><![CDATA[SDS.Services@lpi.nsw.gov.au]]></ContactElectronicMailAddress>
+    </ContactInformation>
+    <Fees><![CDATA[]]></Fees>
+    <AccessConstraints><![CDATA[]]></AccessConstraints>
+    <MaxWidth>4096</MaxWidth>
+    <MaxHeight>4096</MaxHeight>
+  </Service>
+  <Capability>
+    <Request>
+      <GetCapabilities>
+        <Format>application/vnd.ogc.wms_xml</Format>
+        <Format>text/xml</Format>
+        <DCPType>
+          <HTTP><Get><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="http://maps.six.nsw.gov.au/arcgis/services/public/NSW_Imagery/MapServer/WmsServer?"/></Get></HTTP>
+        </DCPType>
+      </GetCapabilities>
+      <GetMap>
+        <Format>image/bmp</Format>
+        <Format>image/jpeg</Format>
+        <Format>image/tiff</Format>
+        <Format>image/png</Format>
+        <Format>image/png8</Format>
+        <Format>image/png24</Format>
+        <Format>image/png32</Format>
+        <Format>image/gif</Format>
+        <Format>image/svg+xml</Format>
+        <DCPType>
+          <HTTP><Get><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="http://maps.six.nsw.gov.au/arcgis/services/public/NSW_Imagery/MapServer/WmsServer?"/></Get></HTTP>
+        </DCPType>
+      </GetMap>
+      <GetFeatureInfo>
+        <Format>application/vnd.esri.wms_raw_xml</Format>
+        <Format>application/vnd.esri.wms_featureinfo_xml</Format>
+        <Format>application/vnd.ogc.wms_xml</Format>
+        <Format>application/geojson</Format>
+        <Format>text/xml</Format>
+        <Format>text/html</Format>
+        <Format>text/plain</Format>
+        <DCPType>
+          <HTTP><Get><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="http://maps.six.nsw.gov.au/arcgis/services/public/NSW_Imagery/MapServer/WmsServer?"/></Get></HTTP>
+        </DCPType>
+      </GetFeatureInfo>
+      <esri_wms:GetStyles>
+        <Format>application/vnd.ogc.sld+xml</Format>
+        <DCPType>
+          <HTTP><Get><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="http://maps.six.nsw.gov.au/arcgis/services/public/NSW_Imagery/MapServer/WmsServer?"/></Get></HTTP>
+        </DCPType>
+      </esri_wms:GetStyles>
+    </Request>
+    <Exception>
+      <Format>application/vnd.ogc.se_xml</Format>
+      <Format>application/vnd.ogc.se_inimage</Format>
+      <Format>application/vnd.ogc.se_blank</Format>
+      <Format>text/xml</Format>
+      <Format>XML</Format>
+    </Exception>
+    <Layer>
+      <Title><![CDATA[NSW_Imagery]]></Title>
+<CRS>CRS:84</CRS>
+<CRS>EPSG:4326</CRS>
+<CRS>EPSG:3857</CRS>
+ <!-- alias 3857 -->
+<CRS>EPSG:102100</CRS>
+<EX_GeographicBoundingBox><westBoundLongitude>139.236629</westBoundLongitude><eastBoundLongitude>159.289947</eastBoundLongitude><southBoundLatitude>-38.351166</southBoundLatitude><northBoundLatitude>-26.603479</northBoundLatitude></EX_GeographicBoundingBox>
+<BoundingBox CRS="CRS:84" minx="139.236629" miny="-38.351166" maxx="159.289947" maxy="-26.603479"/>
+<BoundingBox CRS="EPSG:4326" minx="-38.351166" miny="139.236629" maxx="-26.603479" maxy="159.289947"/>
+<BoundingBox CRS="EPSG:3857" minx="15499750.634300" miny="-4629153.206800" maxx="17732075.828300" maxy="-3074018.396000"/>
+      <Layer queryable="1">
+        <Name>BestImageryDates</Name>
+        <Title><![CDATA[BestImageryDates]]></Title>
+        <Abstract><![CDATA[]]></Abstract>
+<CRS>CRS:84</CRS>
+<CRS>EPSG:4326</CRS>
+<CRS>EPSG:3857</CRS>
+ <!-- alias 3857 -->
+<CRS>EPSG:102100</CRS>
+<EX_GeographicBoundingBox><westBoundLongitude>139.236629</westBoundLongitude><eastBoundLongitude>159.289947</eastBoundLongitude><southBoundLatitude>-38.351166</southBoundLatitude><northBoundLatitude>-26.603479</northBoundLatitude></EX_GeographicBoundingBox>
+<BoundingBox CRS="CRS:84" minx="139.236629" miny="-38.351166" maxx="159.289947" maxy="-26.603479"/>
+<BoundingBox CRS="EPSG:4326" minx="-38.351166" miny="139.236629" maxx="-26.603479" maxy="159.289947"/>
+<BoundingBox CRS="EPSG:3857" minx="15499750.634300" miny="-4629153.206800" maxx="17732075.828300" maxy="-3074018.396000"/>
+        <Style>
+          <Name>default</Name>
+          <Title>BestImageryDates</Title>
+          <LegendURL width="16" height="16">
+            <Format>image/png</Format>
+            <OnlineResource xlink:href="http://maps.six.nsw.gov.au/arcgis/services/public/NSW_Imagery/MapServer/WmsServer?request=GetLegendGraphic%26version=1.3.0%26format=image/png%26layer=BestImageryDates" xlink:type="simple" xmlns:xlink="http://www.w3.org/1999/xlink" />
+          </LegendURL>
+        </Style>
+      </Layer>
+    </Layer>
+  </Capability>
+</WMS_Capabilities>
Index: /trunk/test/data/__files/nominatim/London.xml
===================================================================
--- /trunk/test/data/__files/nominatim/London.xml	(revision 12557)
+++ /trunk/test/data/__files/nominatim/London.xml	(revision 12557)
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<searchresults timestamp='Tue, 01 Aug 17 19:44:23 +0000'
+	attribution='Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright'
+	querystring='London' polygon='false'
+	exclude_place_ids='172886376,4363712,171577264,393695,173598423,173598634,173598624,173495610,433519,361768,434160'
+	more_url='https://nominatim.openstreetmap.org/search.php?q=London&amp;exclude_place_ids=172886376%2C4363712%2C171577264%2C393695%2C173598423%2C173598634%2C173598624%2C173495610%2C433519%2C361768%2C434160&amp;format=xml&amp;accept-language=fr-FR%2Cfr%3Bq%3D0.8%2Cen-US%3Bq%3D0.6%2Cen%3Bq%3D0.4'>
+	<place place_id='172886376' osm_type='relation' osm_id='65606'
+		place_rank='16' boundingbox="51.2867602,51.6918741,-0.5103751,0.3340155"
+		lat='51.5073219' lon='-0.1276474' display_name='Londres, Grand Londres, Angleterre, Royaume-Uni'
+		class='place' type='city' importance='0.8654895765402'
+		icon='https://nominatim.openstreetmap.org/images/mapicons/poi_place_city.p.20.png' />
+	<place place_id='4363712' osm_type='node' osm_id='485248691'
+		place_rank='16' boundingbox="42.828576,43.148576,-81.406643,-81.086643"
+		lat='42.988576' lon='-81.246643' display_name='London, Ontario, Canada'
+		class='place' type='city' importance='0.6515723047601'
+		icon='https://nominatim.openstreetmap.org/images/mapicons/poi_place_city.p.20.png' />
+	<place place_id='171577264' osm_type='relation' osm_id='130591'
+		place_rank='16' boundingbox="37.079759,37.15226,-84.126262,-84.035957"
+		lat='37.1289771' lon='-84.0832646'
+		display_name='London, Laurel County, Kentucky, États-Unis d&#039;Amérique'
+		class='place' type='city' importance='0.50529223844486'
+		icon='https://nominatim.openstreetmap.org/images/mapicons/poi_place_city.p.20.png' />
+	<place place_id='393695' osm_type='node' osm_id='153408665'
+		place_rank='19' boundingbox="43.0277775,43.0677775,-89.0328881,-88.9928881"
+		lat='43.0477775' lon='-89.0128881'
+		display_name='London, Dane County, Wisconsin, États-Unis d&#039;Amérique'
+		class='place' type='hamlet' importance='0.457828369551'
+		icon='https://nominatim.openstreetmap.org/images/mapicons/poi_place_village.p.20.png' />
+	<place place_id='173598423' osm_type='relation' osm_id='182481'
+		place_rank='16' boundingbox="39.85928,39.921786,-83.478923,-83.389997"
+		lat='39.8864493' lon='-83.448253'
+		display_name='London, Madison County, Ohio, États-Unis d&#039;Amérique'
+		class='place' type='city' importance='0.44543898169688'
+		icon='https://nominatim.openstreetmap.org/images/mapicons/poi_place_city.p.20.png' />
+	<place place_id='173598634' osm_type='relation' osm_id='2730965'
+		place_rank='19' boundingbox="36.4734452,36.4884367,-119.4497699,-119.4385395"
+		lat='36.4760619' lon='-119.4431785'
+		display_name='London, Tulare County, Californie, États-Unis d&#039;Amérique'
+		class='place' type='village' importance='0.42045232539126'
+		icon='https://nominatim.openstreetmap.org/images/mapicons/poi_place_village.p.20.png' />
+	<place place_id='173495610' osm_type='relation' osm_id='111457'
+		place_rank='16' boundingbox="35.315577,35.33814,-93.272693,-93.187375"
+		lat='35.328973' lon='-93.2529553'
+		display_name='London, Pope County, Arkansas, États-Unis d&#039;Amérique'
+		class='place' type='city' importance='0.4184484386218'
+		icon='https://nominatim.openstreetmap.org/images/mapicons/poi_place_city.p.20.png' />
+	<place place_id='433519' osm_type='node' osm_id='154301303'
+		place_rank='19' boundingbox="38.1743567,38.2143567,-81.3886944,-81.3486944"
+		lat='38.1943567' lon='-81.3686944'
+		display_name='London, Kanawha County, Virginie-Occidentale, États-Unis d&#039;Amérique'
+		class='place' type='hamlet' importance='0.41707848858916'
+		icon='https://nominatim.openstreetmap.org/images/mapicons/poi_place_village.p.20.png' />
+	<place place_id='361768' osm_type='node' osm_id='151379108'
+		place_rank='19' boundingbox="32.2109892,32.2509892,-94.9643839,-94.9243839"
+		lat='32.2309892' lon='-94.9443839'
+		display_name='London, Rusk County, Texas, États-Unis d&#039;Amérique'
+		class='place' type='hamlet' importance='0.385'
+		icon='https://nominatim.openstreetmap.org/images/mapicons/poi_place_village.p.20.png' />
+	<place place_id='434160' osm_type='node' osm_id='154083583'
+		place_rank='19' boundingbox="40.8903338,40.9303338,-82.6493412,-82.6093412"
+		lat='40.9103338' lon='-82.6293412'
+		display_name='London, Cass Township, Richland County, Ohio, États-Unis d&#039;Amérique'
+		class='place' type='hamlet' importance='0.385'
+		icon='https://nominatim.openstreetmap.org/images/mapicons/poi_place_village.p.20.png' />
+</searchresults>
Index: /trunk/test/data/__files/nominatim/foo-bar-baz-does-not-exist.xml
===================================================================
--- /trunk/test/data/__files/nominatim/foo-bar-baz-does-not-exist.xml	(revision 12557)
+++ /trunk/test/data/__files/nominatim/foo-bar-baz-does-not-exist.xml	(revision 12557)
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<searchresults timestamp='Tue, 01 Aug 17 20:32:17 +0000'
+	attribution='Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright'
+	querystring='foo-bar-baz-does-not-exist' polygon='false'
+	more_url='https://nominatim.openstreetmap.org/search.php?q=foo-bar-baz-does-not-exist&amp;format=xml&amp;accept-language=fr-FR%2Cfr%3Bq%3D0.8%2Cen-US%3Bq%3D0.6%2Cen%3Bq%3D0.4'>
+</searchresults>
Index: /trunk/test/data/__files/presets/Presets_BicycleJunction-preset.xml
===================================================================
--- /trunk/test/data/__files/presets/Presets_BicycleJunction-preset.xml	(revision 12557)
+++ /trunk/test/data/__files/presets/Presets_BicycleJunction-preset.xml	(revision 12557)
@@ -0,0 +1,120 @@
+<presets xmlns="http://josm.openstreetmap.de/tagging-preset-1.0"
+         author="Adiac"
+         description="Bicycle network related waypoints"
+         shortdescription="Bicycle waypoints"
+         version="1.3_2012-11-27">
+	<group name="Bicyclejunction" de.name="Fahrradknotenpunkt">
+		<item name="International (icn): Guidepost" de.name="International (icn): Wegweiser" type="node">
+			<label text="International (icn): Guidepost" de.text="International (icn): Wegweiser" />
+			<key key="tourism" value="information" />
+			<key key="information" value="guidepost" />
+			<key key="network" value="icn" />
+			<key key="bicycle" value="yes" />
+			<key key="icn" value="yes" />
+			<text key="icn_ref" text="Junctionnr." de.text="Knotenpunkt-Nr." />
+			<text key="note" text="Note" de.text="Bemerkung" default="Fahrradknotenpunkt ##" />
+			<link href="http://wiki.openstreetmap.org/wiki/Radverkehrsnetz_NRW#Beispiel" />
+		</item>
+		<item name="International (icn): Map" de.name="International (icn): Karte" type="node">
+			<label text="International (icn): Map" de.text="International (icn): Karte" />
+			<key key="tourism" value="information" />
+			<key key="information" value="map" />
+			<key key="network" value="icn" />
+			<key key="bicycle" value="yes" />
+			<combo key="map_size" text="Mapsize" de.text="Kartengröße" values="site,city,region" default="" delete_if_empty="true" />
+			<combo key="map_type" text="Maptype" de.text="Kartentyp" values="topo,street,scheme" default="" delete_if_empty="true" />
+			<link href="http://wiki.openstreetmap.org/wiki/Radverkehrsnetz_NRW#Beispiel" />
+		</item>
+		<item name="Local (lcn): Guidepost" de.name="Lokal (lcn): Wegweiser" type="node">
+			<label text="Local (lcn): Guidepost" de.text="Lokal (lcn): Wegweiser" />
+			<key key="tourism" value="information" />
+			<key key="information" value="guidepost" />
+			<key key="network" value="lcn" />
+			<key key="bicycle" value="yes" />
+			<key key="lcn" value="yes" />
+			<text key="lcn_ref" text="Junctionnr." de.text="Knotenpunkt-Nr." />
+			<text key="note" text="Note" de.text="Bemerkung" default="Fahrradknotenpunkt ##" />
+			<link href="http://wiki.openstreetmap.org/wiki/Radverkehrsnetz_NRW#Beispiel" />
+		</item>
+		<item name="Local (lcn): Map" de.name="Lokal (lcn): Karte " type="node">
+			<label text="Local (lcn): Map" de.text="Lokal (lcn): Karte" />
+			<key key="tourism" value="information" />
+			<key key="information" value="map" />
+			<key key="network" value="lcn" />
+			<key key="bicycle" value="yes" />
+			<combo key="map_size" text="Mapsize" de.text="Kartengröße" values="site,city,region" default="" delete_if_empty="true" />
+			<combo key="map_type" text="Maptype" de.text="Kartentyp" values="topo,street,scheme" default="" delete_if_empty="true" />
+			<link href="http://wiki.openstreetmap.org/wiki/Radverkehrsnetz_NRW#Beispiel" />
+		</item>
+		<item name="National (ncn): Guidepost" de.name="National (ncn): Wegweiser" type="node">
+			<label text="National (ncn): Guidepost" de.text="National (ncn): Wegweiser" />
+			<key key="tourism" value="information" />
+			<key key="information" value="guidepost" />
+			<key key="network" value="ncn" />
+			<key key="bicycle" value="yes" />
+			<key key="ncn" value="yes" />
+			<text key="ncn_ref" text="Junctionnr." de.text="Knotenpunkt-Nr." />
+			<text key="note" text="Note" de.text="Bemerkung" default="Fahrradknotenpunkt ##" />
+			<link href="http://wiki.openstreetmap.org/wiki/Radverkehrsnetz_NRW#Beispiel" />
+		</item>
+		<item name="National (ncn): Map" de.name="National (ncn): Karte" type="node">
+			<label text="National (ncn): Map" de.text="National (ncn): Karte" />
+			<key key="tourism" value="information" />
+			<key key="information" value="map" />
+			<key key="network" value="ncn" />
+			<key key="bicycle" value="yes" />
+			<combo key="map_size" text="Mapsize" de.text="Kartengröße" values="site,city,region" default="" delete_if_empty="true" />
+			<combo key="map_type" text="Maptype" de.text="Kartentyp" values="topo,street,scheme" default="" delete_if_empty="true" />
+			<link href="http://wiki.openstreetmap.org/wiki/Radverkehrsnetz_NRW#Beispiel" />
+		</item>
+		<item name="Regional (rcn): Guidepost" de.name="Regional (rcn): Wegweiser" type="node">
+			<label text="Regional (rcn): Guidepost" de.text="Regional (rcn): Wegweiser" />
+			<key key="tourism" value="information" />
+			<key key="information" value="guidepost" />
+			<key key="network" value="rcn" />
+			<key key="bicycle" value="yes" />
+			<key key="rcn" value="yes" />
+			<text key="rcn_ref" text="Junctionnr." de.text="Knotenpunkt-Nr." />
+			<text key="note" text="Note" de.text="Bemerkung" default="Fahrradknotenpunkt ##" />
+			<link href="http://wiki.openstreetmap.org/wiki/Radverkehrsnetz_NRW#Beispiel" />
+		</item>
+		<item name="Regional (rcn): Map" de.name="Regional (rcn): Karte" type="node">
+			<label text="Regional (rcn): Map" de.text="Regional (rcn): Karte" />
+			<key key="tourism" value="information" />
+			<key key="information" value="map" />
+			<key key="network" value="rcn" />
+			<key key="bicycle" value="yes" />
+			<combo key="map_size" text="Mapsize" de.text="Kartengröße" values="site,city,region" default="" delete_if_empty="true" />
+			<combo key="map_type" text="Maptype" de.text="Kartentyp" values="topo,street,scheme" default="" delete_if_empty="true" />
+			<link href="http://wiki.openstreetmap.org/wiki/Radverkehrsnetz_NRW#Beispiel" />
+		</item>
+	</group>
+        <item name="LF bicycle relation ncn" type="relation"
+            name_template="route(?{'{network} '}?{'{ref} '}?{'{name} '}?{'{from} - {via} - {to} ' | '{from} - {to} ' | '{from} ' | '{to} '}?{'{note} '})"
+            name_template_filter="type=route network=ncn route=bicycle">
+        </item>
+        <item name="Node Network Route relation" type="relation"
+            name_template="route(?{'{network} '}!{parent() type=network(network=rcn|network=rwn|network=rhn)'?{'{ref}' | ''}'}?{'{ref} '}?{'{note} '}?{'{name}'}"
+            name_template_filter="type=route (route=bicycle | route=foot | route = hiking | route = walking | route = horse)">
+        </item>
+        <item name="Node Network Network relation" type="relation"
+            name_template="network(rcn ?{'{addr:country} '}?{'{addr:province} '}?{'{name}'}"
+            name_template_filter="type=network network=rcn">
+        </item>
+        <item name="Node Network node" type="node"
+            name_template="?{'FKp {rcn_ref}'}?{' / WKp {rwn_ref}'}"
+            name_template_filter="type:node rcn_ref rwn_ref">
+        </item>
+        <item name="Node Network node" type="node"
+            name_template="FKp {rcn_ref}"
+            name_template_filter="type:node rcn_ref">
+        </item>
+        <item name="Node Network node" type="node"
+            name_template="WKp {rwn_ref}"
+            name_template_filter="type:node rwn_ref">
+        </item>
+        <item name="Node Network node" type="node"
+            name_template="PKp {rhn_ref}"
+            name_template_filter="type:node rhn_ref">
+        </item>
+</presets>
Index: /trunk/test/data/__files/samples/data.gpx
===================================================================
--- /trunk/test/data/__files/samples/data.gpx	(revision 12557)
+++ /trunk/test/data/__files/samples/data.gpx	(revision 12557)
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gpx xmlns="http://www.topografix.com/GPX/1/0" xmlns:osm="http://www.openstreetmap.org" version="1.0" creator="JOSM">
+  <trk>
+    <name>105241</name>
+    <extensions>
+      <osm:property key="trkseg" value="&#xA;      &#xA;        146791&#xA;      &#xA;      &#xA;        146797&#xA;      &#xA;    " />
+    </extensions>
+    <trkseg>
+      <trkpt lat="48.08120346069336" lon="11.736961364746094">
+        <name>146791</name>
+      </trkpt>
+      <trkpt lat="48.07872009277344" lon="11.734161376953125">
+        <name>146797</name>
+      </trkpt>
+    </trkseg>
+  </trk>
+  <trk>
+    <name>85964</name>
+    <extensions>
+      <osm:property key="trkseg" value="&#xA;      &#xA;        128286&#xA;      &#xA;      &#xA;        128287&#xA;      &#xA;    " />
+    </extensions>
+    <trkseg>
+      <trkpt lat="48.155582427978516" lon="11.422438621520996">
+        <name>128286</name>
+      </trkpt>
+      <trkpt lat="48.1555061340332" lon="11.422523498535156">
+        <name>128287</name>
+      </trkpt>
+    </trkseg>
+  </trk>
+  <wpt lat="48.17121887207031" lon="11.717523574829102" />
+  <wpt lat="48.17500686645508" lon="11.753143310546875" />
+  <wpt lat="48.176429748535156" lon="11.752127647399902" />
+  <wpt lat="48.1754264831543" lon="11.754337310791016" />
+  <wpt lat="48.174217224121094" lon="11.424162864685059">
+    <name>128957</name>
+  </wpt>
+</gpx>
Index: /trunk/test/data/__files/samples/data.osm
===================================================================
--- /trunk/test/data/__files/samples/data.osm	(revision 12557)
+++ /trunk/test/data/__files/samples/data.osm	(revision 12557)
@@ -0,0 +1,70 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<osm version='0.6' upload='never' generator='JOSM'>
+  <node id='-27' action='modify' timestamp='2010-01-24T10:28:01Z' visible='true' lat='0.47771177330651926' lon='-1.214837040993729' />
+  <node id='-13' action='modify' timestamp='2010-01-24T10:28:01Z' visible='true' lat='0.4770456414460069' lon='-1.2128480891895201' />
+  <node id='-96' action='modify' timestamp='2010-01-24T10:28:01Z' visible='true' lat='0.4764633314455231' lon='-1.2128409733562326' />
+  <node id='-97' action='modify' timestamp='2010-01-24T10:28:01Z' visible='true' lat='0.4758285965581824' lon='-1.2099736236471972' />
+  <node id='-26' action='modify' timestamp='2010-01-24T10:28:01Z' visible='true' lat='0.4792876662805732' lon='-1.2169820812340761' />
+  <node id='-19' action='modify' timestamp='2010-01-24T10:28:01Z' visible='true' lat='0.48036950894773345' lon='-1.2131904879318611' />
+  <node id='-14' action='modify' timestamp='2010-01-24T10:28:01Z' visible='true' lat='0.4791657020375284' lon='-1.2102793618913894' />
+  <node id='-12' action='modify' timestamp='2010-01-24T10:28:01Z' visible='true' lat='0.4798004366165714' lon='-1.213146711600425' />
+  <node id='-10' action='modify' timestamp='2010-01-24T10:28:01Z' visible='true' lat='0.47936268863731496' lon='-1.213146711600425' />
+  <node id='-17' action='modify' timestamp='2010-01-24T10:28:01Z' visible='true' lat='0.4813140315130982' lon='-1.2101234506227323' />
+  <node id='-18' action='modify' timestamp='2010-01-24T10:28:01Z' visible='true' lat='0.48267104976957914' lon='-1.213034576663203' />
+  <node id='-15' action='modify' timestamp='2010-01-24T10:28:01Z' visible='true' lat='0.4822989641455303' lon='-1.2129689121660499' />
+  <node id='-11' action='modify' timestamp='2010-01-24T10:28:01Z' visible='true' lat='0.48166422979871726' lon='-1.2101015624570148' />
+  <node id='-32' action='modify' timestamp='2010-01-24T10:28:01Z' visible='true' lat='0.4751195493564001' lon='-1.2048370205367955' />
+  <node id='-99' action='modify' timestamp='2010-01-24T10:28:01Z' visible='true' lat='0.4745372391933516' lon='-1.2048299047035078' />
+  <node id='-36' action='modify' timestamp='2010-01-24T10:28:01Z' visible='true' lat='0.47669544292428195' lon='-1.2069820607771429' />
+  <node id='-24' action='modify' timestamp='2010-01-24T10:28:01Z' visible='true' lat='0.4774365971965075' lon='-1.2051356429477' />
+  <node id='-21' action='modify' timestamp='2010-01-24T10:28:01Z' visible='true' lat='0.47693318684453173' lon='-1.2051794192791356' />
+  <node id='-22' action='modify' timestamp='2010-01-24T10:28:01Z' visible='true' lat='0.4778743452986904' lon='-1.2051356429477' />
+  <node id='-98' action='modify' timestamp='2010-01-24T10:28:01Z' visible='true' lat='0.4761131328941895' lon='-1.2069749449438552' />
+  <node id='-29' action='modify' timestamp='2010-01-24T10:28:01Z' visible='true' lat='0.4800226751795712' lon='-1.204979731679043' />
+  <node id='-34' action='modify' timestamp='2010-01-24T10:28:01Z' visible='true' lat='0.4803728735314377' lon='-1.2049578435133252' />
+  <node id='-30' action='modify' timestamp='2010-01-24T10:28:01Z' visible='true' lat='0.4800193105956951' lon='-1.2073244595194834' />
+  <node id='-25' action='modify' timestamp='2010-01-24T10:28:01Z' visible='true' lat='0.47850907999728337' lon='-1.207324459519483' />
+  <node id='-23' action='modify' timestamp='2010-01-24T10:28:01Z' visible='true' lat='0.4784434177898294' lon='-1.2051794192791356' />
+  <node id='-33' action='modify' timestamp='2010-01-24T10:28:01Z' visible='true' lat='0.479450238235392' lon='-1.2072806831880476' />
+  <node id='-35' action='modify' timestamp='2010-01-24T10:28:01Z' visible='true' lat='0.4790124902337393' lon='-1.2072806831880474' />
+  <node id='-37' action='modify' timestamp='2010-01-24T10:28:01Z' visible='true' lat='0.48136874999641444' lon='-1.2036554976531113' />
+  <node id='-44' action='modify' timestamp='2010-01-24T10:28:01Z' visible='true' lat='0.48171894827922374' lon='-1.2036336094873938' />
+  <node id='-45' action='modify' timestamp='2010-01-24T10:28:01Z' visible='true' lat='0.4820910339349863' lon='-1.2036992739845465' />
+  <node id='-38' action='modify' timestamp='2010-01-24T10:28:01Z' visible='true' lat='0.4819487658925157' lon='-1.2071028837536724' />
+  <node id='-40' action='modify' timestamp='2010-01-24T10:28:01Z' visible='true' lat='0.482320851535727' lon='-1.2071685482508254' />
+  <node id='-42' action='modify' timestamp='2010-01-24T10:28:01Z' visible='true' lat='0.4822551893648863' lon='-1.204979731679043' />
+  <node id='-43' action='modify' timestamp='2010-01-24T10:28:01Z' visible='true' lat='0.4807449592606228' lon='-1.2050235080104783' />
+  <node id='-39' action='modify' timestamp='2010-01-24T10:28:01Z' visible='true' lat='0.4828461488797523' lon='-1.205089172507632' />
+  <node id='-41' action='modify' timestamp='2010-01-24T10:28:01Z' visible='true' lat='0.4815985676215157' lon='-1.20712477191939' />
+  <node id='-51' action='modify' timestamp='2010-01-24T10:28:01Z' visible='true' lat='0.4807340155630004' lon='-1.2007881479440765' />
+  <node id='-47' action='modify' timestamp='2010-01-24T10:28:01Z' visible='true' lat='0.48136874999640183' lon='-1.1977675810750161' />
+  <node id='-48' action='modify' timestamp='2010-01-24T10:28:01Z' visible='true' lat='0.4810842138783876' lon='-1.2007662597783586' />
+  <node id='-46' action='modify' timestamp='2010-01-24T10:28:01Z' visible='true' lat='0.48174083567128484' lon='-1.1978332455721696' />
+  <node id='-49' action='modify' timestamp='2010-01-24T10:28:01Z' visible='true' lat='0.48101855169561025' lon='-1.1977894692407338' />
+  <node id='-50' action='modify' timestamp='2010-01-24T10:28:01Z' visible='true' lat='0.48145629956880753' lon='-1.200831924275512' />
+  <node id='-54' action='modify' timestamp='2010-01-24T10:28:01Z' visible='true' lat='0.47960857628212794' lon='-1.1959762749469767' />
+  <node id='-53' action='modify' timestamp='2010-01-24T10:28:01Z' visible='true' lat='0.4797928575014292' lon='-1.1956225408346692' />
+  <node id='-55' action='modify' timestamp='2010-01-24T10:28:01Z' visible='true' lat='0.4824972674572115' lon='-1.1959611311835499' />
+  <node id='-52' action='modify' timestamp='2010-01-24T10:28:01Z' visible='true' lat='0.4801649432621869' lon='-1.195688205331822' />
+  <node id='-60' timestamp='2010-01-24T10:28:01Z' visible='true' lat='0.48479412617580425' lon='-1.2101234506227323' />
+  <node id='-65' action='modify' timestamp='2010-01-24T10:28:01Z' visible='true' lat='0.48477223879355674' lon='-1.2131002411603569' />
+  <node id='-62' action='modify' timestamp='2010-01-24T10:28:01Z' visible='true' lat='0.4841375046778457' lon='-1.2102328914513212' />
+  <node id='-63' timestamp='2010-01-24T10:28:01Z' visible='true' lat='0.48542886022998155' lon='-1.2129908003317675' />
+  <node id='-57' action='modify' timestamp='2010-01-24T10:28:01Z' visible='true' lat='0.48354654527531427' lon='-1.210123450622732' />
+  <node id='-64' action='modify' timestamp='2010-01-24T10:28:01Z' visible='true' lat='0.4841812794463481' lon='-1.2129908003317675' />
+  <node id='-56' timestamp='2010-01-24T10:28:01Z' visible='true' lat='0.48507866213848755' lon='-1.20712477191939' />
+  <node id='-58' action='modify' timestamp='2010-01-24T10:28:01Z' visible='true' lat='0.48442204066808775' lon='-1.2072342127479787' />
+  <node id='-67' action='modify' timestamp='2010-01-24T10:28:01Z' visible='true' lat='0.48442335747002924' lon='-1.2039721998362745' />
+  <node id='-66' action='modify' timestamp='2010-01-24T10:28:01Z' visible='true' lat='0.48407315932651057' lon='-1.1981061714238967' />
+  <node id='-68' action='modify' timestamp='2010-01-24T10:28:01Z' visible='true' lat='0.4837886233216322' lon='-1.201104850127239' />
+  <node id='-59' action='modify' timestamp='2010-01-24T10:28:01Z' visible='true' lat='0.4838310812903243' lon='-1.2071247719193896' />
+  <node id='-61' timestamp='2010-01-24T10:28:01Z' visible='true' lat='0.48350277050269397' lon='-1.204979731679043' />
+  <way id='-69' action='modify' timestamp='2010-01-24T10:28:01Z' visible='true'>
+    <nd ref='-65' />
+    <nd ref='-62' />
+    <nd ref='-58' />
+    <nd ref='-39' />
+    <tag k='highway' v='residential' />
+    <tag k='oneway' v='yes' />
+  </way>
+</osm>
Index: /trunk/test/data/__files/samples/data.osn
===================================================================
--- /trunk/test/data/__files/samples/data.osn	(revision 12557)
+++ /trunk/test/data/__files/samples/data.osn	(revision 12557)
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<osm-notes>
+<note id="4" lat="36.7232991" lon="68.8641500" created_at="2013-04-24T08:07:02Z" closed_at="2013-04-24T08:08:51Z">
+  <comment action="opened" timestamp="2013-04-24T08:07:02Z" uid="1626" user="FredB">test</comment>
+  <comment action="closed" timestamp="2013-04-24T08:08:51Z" uid="1626" user="FredB"></comment>
+</note>
+<note id="5" lat="51.7609210" lon="-0.0112063" created_at="2013-04-24T08:10:38Z" closed_at="2013-04-24T21:31:47Z">
+  <comment action="opened" timestamp="2013-04-24T08:10:38Z" uid="3980" user="TomH">This building has been demolished and is currently a construction site.</comment>
+  <comment action="closed" timestamp="2013-04-24T21:31:47Z" uid="3980" user="TomH"></comment>
+</note>
+<note id="6" lat="35.5170066" lon="139.6322554" created_at="2013-04-24T08:12:38Z" closed_at="2013-05-10T12:28:11Z">
+  <comment action="opened" timestamp="2013-04-24T08:12:38Z" uid="378532" user="nyampire">Ministopは閉店済み</comment>
+  <comment action="closed" timestamp="2013-05-10T12:28:11Z" uid="10353" user="gorn">name corrected</comment>
+</note>
+<note id="7" lat="50.9381992" lon="1.8605947" created_at="2013-04-24T08:14:28Z" closed_at="2013-04-24T08:14:50Z">
+  <comment action="opened" timestamp="2013-04-24T08:14:28Z">Adresse complète :
+B&amp;B CALAIS Centre St Pierre 	 
+ZAC Curie
+Rue de Lille
+62100 CALAIS
+Tel. 08 92 70 75 18 (0.34€ TTC/mn depuis un poste fixe)
+Fax. 03 21 00 92 71
+Parking, accès handicapé, wifi, ascenseur, caméra</comment>
+  <comment action="closed" timestamp="2013-04-24T08:14:50Z" uid="37548" user="Marcussacapuces91"></comment>
+</note>
+<note id="289379" lat="50.3699789" lon="8.6278027" created_at="2014-12-21T01:30:26Z">
+  <comment action="opened" timestamp="2014-12-21T01:30:26Z">Freizeitheim Uhu</comment>
+</note>
+<note id="289380" lat="48.5979475" lon="-2.1622145" created_at="2014-12-21T01:51:36Z">
+  <comment action="opened" timestamp="2014-12-21T01:51:36Z">parking</comment>
+</note>
+<note id="289381" lat="49.8535075" lon="20.9857535" created_at="2014-12-21T02:14:51Z" closed_at="2014-12-21T02:16:33Z">
+  <comment action="opened" timestamp="2014-12-21T02:14:51Z">to nie ścieżka</comment>
+  <comment action="closed" timestamp="2014-12-21T02:16:33Z" uid="163896" user="Zbigniew_Czernik">zgadza się</comment>
+</note>
+<note id="289382" lat="49.8537980" lon="20.9873736" created_at="2014-12-21T02:15:04Z">
+  <comment action="opened" timestamp="2014-12-21T02:15:04Z">to nie ścieżka</comment>
+</note>
+<note id="289383" lat="49.8525390" lon="20.9827387" created_at="2014-12-21T02:15:23Z" closed_at="2014-12-21T02:18:01Z">
+  <comment action="opened" timestamp="2014-12-21T02:15:23Z">o to za droga i dlaczego brak jej oznaczenia w legendzie?</comment>
+  <comment action="closed" timestamp="2014-12-21T02:18:01Z" uid="163896" user="Zbigniew_Czernik">bo legenda jest stara i nieaktualna. To jest droga lokalna.</comment>
+</note>
+</osm-notes>
Index: /trunk/test/unit/org/openstreetmap/josm/actions/AddImageryLayerActionTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/actions/AddImageryLayerActionTest.java	(revision 12556)
+++ /trunk/test/unit/org/openstreetmap/josm/actions/AddImageryLayerActionTest.java	(revision 12557)
@@ -2,4 +2,8 @@
 package org.openstreetmap.josm.actions;
 
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.get;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
+import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
@@ -10,7 +14,11 @@
 import org.junit.Test;
 import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.TestUtils;
 import org.openstreetmap.josm.data.imagery.ImageryInfo;
 import org.openstreetmap.josm.gui.layer.TMSLayer;
+import org.openstreetmap.josm.gui.layer.WMSLayer;
 import org.openstreetmap.josm.testutils.JOSMTestRules;
+
+import com.github.tomakehurst.wiremock.junit.WireMockRule;
 
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
@@ -30,4 +38,10 @@
 
     /**
+     * HTTP mock.
+     */
+    @Rule
+    public WireMockRule wireMockRule = new WireMockRule(options().dynamicPort().usingFilesUnderDirectory(TestUtils.getTestDataRoot()));
+
+    /**
      * Unit test of {@link AddImageryLayerAction#updateEnabledState}.
      */
@@ -45,5 +59,5 @@
      */
     @Test
-    public void testActionPerformedEnabled() {
+    public void testActionPerformedEnabledTms() {
         assertTrue(Main.getLayerManager().getLayersOfType(TMSLayer.class).isEmpty());
         new AddImageryLayerAction(new ImageryInfo("foo_tms", "http://bar", "tms", null, null)).actionPerformed(null);
@@ -51,4 +65,22 @@
         assertEquals(1, tmsLayers.size());
         Main.getLayerManager().removeLayer(tmsLayers.get(0));
+    }
+
+    /**
+     * Unit test of {@link AddImageryLayerAction#actionPerformed} - Enabled cases for WMS.
+     */
+    @Test
+    public void testActionPerformedEnabledWms() {
+        wireMockRule.stubFor(get(urlEqualTo("/wms?VERSION=1.1.1&SERVICE=WMS&REQUEST=GetCapabilities"))
+                .willReturn(aResponse()
+                    .withStatus(200)
+                    .withHeader("Content-Type", "text/xml")
+                    .withBodyFile("imagery/wms-capabilities.xml")));
+        new AddImageryLayerAction(new ImageryInfo("localhost", "http://localhost:" + wireMockRule.port() + "/wms?",
+                "wms_endpoint", null, null)).actionPerformed(null);
+        List<WMSLayer> wmsLayers = Main.getLayerManager().getLayersOfType(WMSLayer.class);
+        assertEquals(1, wmsLayers.size());
+
+        Main.getLayerManager().removeLayer(wmsLayers.get(0));
     }
 
Index: unk/test/unit/org/openstreetmap/josm/actions/AddImageryLayerActionTestIT.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/actions/AddImageryLayerActionTestIT.java	(revision 12556)
+++ 	(revision )
@@ -1,42 +1,0 @@
-// License: GPL. For details, see LICENSE file.
-package org.openstreetmap.josm.actions;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.List;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.openstreetmap.josm.Main;
-import org.openstreetmap.josm.data.imagery.ImageryInfo;
-import org.openstreetmap.josm.gui.layer.WMSLayer;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
-
-/**
- * Unit tests for class {@link AddImageryLayerAction}.
- */
-public final class AddImageryLayerActionTestIT {
-    /**
-     * We need prefs for this. We need platform for actions and the OSM API for checking blacklist.
-     * The timeout is set to default httpclient read timeout + connect timeout + a small delay to ignore
-     * common but harmless network issues.
-     */
-    @Rule
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().preferences().platform().fakeAPI().timeout(45500);
-
-    /**
-     * Integration test of {@link AddImageryLayerAction#actionPerformed} - Enabled cases for WMS.
-     */
-    @Test
-    public void testActionPerformedEnabledWms() {
-        new AddImageryLayerAction(new ImageryInfo("wms.openstreetmap.fr", "http://wms.openstreetmap.fr/wms?",
-                "wms_endpoint", null, null)).actionPerformed(null);
-        List<WMSLayer> wmsLayers = Main.getLayerManager().getLayersOfType(WMSLayer.class);
-        assertEquals(1, wmsLayers.size());
-
-        Main.getLayerManager().removeLayer(wmsLayers.get(0));
-    }
-}
Index: /trunk/test/unit/org/openstreetmap/josm/actions/downloadtasks/AbstractDownloadTaskTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/actions/downloadtasks/AbstractDownloadTaskTest.java	(revision 12557)
+++ /trunk/test/unit/org/openstreetmap/josm/actions/downloadtasks/AbstractDownloadTaskTest.java	(revision 12557)
@@ -0,0 +1,59 @@
+// License: GPL. For details, see LICENSE file.
+package org.openstreetmap.josm.actions.downloadtasks;
+
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.get;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
+import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
+
+import org.junit.Rule;
+import org.openstreetmap.josm.TestUtils;
+import org.openstreetmap.josm.testutils.JOSMTestRules;
+
+import com.github.tomakehurst.wiremock.junit.WireMockRule;
+
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+
+/**
+ * Superclass of {@link DownloadGpsTaskTest}, {@link DownloadOsmTaskTest} and {@link DownloadNotesTaskTest}.
+ */
+public abstract class AbstractDownloadTaskTest {
+
+    /**
+     * Setup test.
+     */
+    @Rule
+    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
+    public JOSMTestRules test = new JOSMTestRules().https();
+
+    /**
+     * HTTP mock.
+     */
+    @Rule
+    public WireMockRule wireMockRule = new WireMockRule(options().dynamicPort().usingFilesUnderDirectory(TestUtils.getTestDataRoot()));
+
+    /**
+     * Returns the path to remote test file to download via http.
+     * @return the path to remote test file, relative to JOSM root directory
+     */
+    protected abstract String getRemoteFile();
+
+    /**
+     * Returns the http URL to remote test file to download.
+     * @return the http URL to remote test file to download
+     */
+    protected final String getRemoteFileUrl() {
+        return "http://localhost:" + wireMockRule.port() + "/" + getRemoteFile();
+    }
+
+    /**
+     * Mock the HTTP server.
+     */
+    protected final void mockHttp() {
+        wireMockRule.stubFor(get(urlEqualTo("/" + getRemoteFile()))
+                .willReturn(aResponse()
+                    .withStatus(200)
+                    .withHeader("Content-Type", "text/xml")
+                    .withBodyFile(getRemoteFile())));
+    }
+}
Index: /trunk/test/unit/org/openstreetmap/josm/actions/downloadtasks/DownloadGpsTaskTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/actions/downloadtasks/DownloadGpsTaskTest.java	(revision 12556)
+++ /trunk/test/unit/org/openstreetmap/josm/actions/downloadtasks/DownloadGpsTaskTest.java	(revision 12557)
@@ -8,24 +8,11 @@
 import java.util.concurrent.ExecutionException;
 
-import org.junit.Rule;
 import org.junit.Test;
 import org.openstreetmap.josm.data.gpx.GpxData;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 
 /**
  * Unit tests for class {@link DownloadGpsTask}.
  */
-public class DownloadGpsTaskTest {
-
-    private static final String REMOTE_FILE = "https://josm.openstreetmap.de/export/head/josm/trunk/data_nodist/munich.gpx";
-
-    /**
-     * Setup test.
-     */
-    @Rule
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().https();
+public class DownloadGpsTaskTest extends AbstractDownloadTaskTest {
 
     /**
@@ -45,5 +32,5 @@
         assertTrue(task.acceptsUrl("https://www.openstreetmap.org/edit?gpx=750057"));
         assertTrue(task.acceptsUrl("http://www.openstreetmap.org/edit?gpx=2277313#map=14/-20.7321/-40.5328"));
-        assertTrue(task.acceptsUrl(REMOTE_FILE));
+        assertTrue(task.acceptsUrl(getRemoteFileUrl()));
     }
 
@@ -55,6 +42,7 @@
     @Test
     public void testDownloadExternalFile() throws InterruptedException, ExecutionException {
+        mockHttp();
         DownloadGpsTask task = new DownloadGpsTask();
-        task.loadUrl(false, REMOTE_FILE, null).get();
+        task.loadUrl(false, getRemoteFileUrl(), null).get();
         GpxData data = task.getDownloadedData();
         assertNotNull(data);
@@ -62,3 +50,8 @@
         assertFalse(data.tracks.isEmpty());
     }
+
+    @Override
+    protected String getRemoteFile() {
+        return "samples/data.gpx";
+    }
 }
Index: /trunk/test/unit/org/openstreetmap/josm/actions/downloadtasks/DownloadNotesTaskTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/actions/downloadtasks/DownloadNotesTaskTest.java	(revision 12556)
+++ /trunk/test/unit/org/openstreetmap/josm/actions/downloadtasks/DownloadNotesTaskTest.java	(revision 12557)
@@ -8,24 +8,11 @@
 import java.util.concurrent.ExecutionException;
 
-import org.junit.Rule;
 import org.junit.Test;
 import org.openstreetmap.josm.data.osm.NoteData;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 
 /**
  * Unit tests for class {@link DownloadNotesTask}.
  */
-public class DownloadNotesTaskTest {
-
-    private static final String REMOTE_FILE = "https://josm.openstreetmap.de/export/head/josm/trunk/test/data/planet-notes-extract.osn";
-
-    /**
-     * Setup test.
-     */
-    @Rule
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().platform().https();
+public class DownloadNotesTaskTest extends AbstractDownloadTaskTest {
 
     /**
@@ -41,5 +28,5 @@
         assertTrue(task.acceptsUrl("http://api.openstreetmap.org/api/0.6/notes.xml?bbox=-0.65094,51.312159,0.374908,51.669148"));
         assertTrue(task.acceptsUrl("http://api.openstreetmap.org/api/0.6/notes.gpx?bbox=-0.65094,51.312159,0.374908,51.669148"));
-        assertTrue(task.acceptsUrl(REMOTE_FILE));
+        assertTrue(task.acceptsUrl(getRemoteFileUrl()));
     }
 
@@ -51,9 +38,15 @@
     @Test
     public void testDownloadExternalFile() throws InterruptedException, ExecutionException {
+        mockHttp();
         DownloadNotesTask task = new DownloadNotesTask();
-        task.loadUrl(false, REMOTE_FILE, null).get();
+        task.loadUrl(false, getRemoteFileUrl(), null).get();
         NoteData data = task.getDownloadedData();
         assertNotNull(data);
         assertFalse(data.getNotes().isEmpty());
     }
+
+    @Override
+    protected String getRemoteFile() {
+        return "samples/data.osn";
+    }
 }
Index: /trunk/test/unit/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTaskTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTaskTest.java	(revision 12556)
+++ /trunk/test/unit/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTaskTest.java	(revision 12557)
@@ -8,24 +8,11 @@
 import java.util.concurrent.ExecutionException;
 
-import org.junit.Rule;
 import org.junit.Test;
 import org.openstreetmap.josm.data.osm.DataSet;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 
 /**
  * Unit tests for class {@link DownloadOsmTask}.
  */
-public class DownloadOsmTaskTest {
-
-    private static final String REMOTE_FILE = "https://josm.openstreetmap.de/export/head/josm/trunk/data_nodist/direction-arrows.osm";
-
-    /**
-     * Setup test.
-     */
-    @Rule
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().https();
+public class DownloadOsmTaskTest extends AbstractDownloadTaskTest {
 
     /**
@@ -43,5 +30,5 @@
         assertTrue(task.acceptsUrl("http://api.openstreetmap.org/api/0.6/ways?ways=101,102,103"));
         assertTrue(task.acceptsUrl("http://api.openstreetmap.org/api/0.6/relations?relations=101,102,103"));
-        assertTrue(task.acceptsUrl(REMOTE_FILE));
+        assertTrue(task.acceptsUrl(getRemoteFileUrl()));
     }
 
@@ -53,6 +40,7 @@
     @Test
     public void testDownloadExternalFile() throws InterruptedException, ExecutionException {
+        mockHttp();
         DownloadOsmTask task = new DownloadOsmTask();
-        task.loadUrl(false, REMOTE_FILE, null).get();
+        task.loadUrl(false, getRemoteFileUrl(), null).get();
         DataSet ds = task.getDownloadedData();
         assertNotNull(ds);
@@ -60,3 +48,8 @@
         assertFalse(ds.getWays().isEmpty());
     }
+
+    @Override
+    protected String getRemoteFile() {
+        return "samples/data.osm";
+    }
 }
Index: /trunk/test/unit/org/openstreetmap/josm/gui/DefaultNameFormatterTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/gui/DefaultNameFormatterTest.java	(revision 12556)
+++ /trunk/test/unit/org/openstreetmap/josm/gui/DefaultNameFormatterTest.java	(revision 12557)
@@ -2,4 +2,8 @@
 package org.openstreetmap.josm.gui;
 
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.get;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
+import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
 import static org.junit.Assert.assertEquals;
 
@@ -10,7 +14,6 @@
 import java.util.List;
 
-import org.junit.BeforeClass;
+import org.junit.Rule;
 import org.junit.Test;
-import org.openstreetmap.josm.JOSMFixture;
 import org.openstreetmap.josm.TestUtils;
 import org.openstreetmap.josm.data.osm.DataSet;
@@ -24,5 +27,8 @@
 import org.openstreetmap.josm.io.IllegalDataException;
 import org.openstreetmap.josm.io.OsmReader;
+import org.openstreetmap.josm.testutils.JOSMTestRules;
 import org.xml.sax.SAXException;
+
+import com.github.tomakehurst.wiremock.junit.WireMockRule;
 
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
@@ -34,10 +40,15 @@
 
     /**
-     * Setup tests
+     * Setup test.
      */
-    @BeforeClass
-    public static void setUpBeforeClass() {
-        JOSMFixture.createUnitTestFixture().init();
-    }
+    @Rule
+    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
+    public JOSMTestRules test = new JOSMTestRules().platform();
+
+    /**
+     * HTTP mock.
+     */
+    @Rule
+    public WireMockRule wireMockRule = new WireMockRule(options().dynamicPort().usingFilesUnderDirectory(TestUtils.getTestDataRoot()));
 
     /**
@@ -50,6 +61,11 @@
     @SuppressFBWarnings(value = "ITA_INEFFICIENT_TO_ARRAY")
     public void testTicket9632() throws IllegalDataException, IOException, SAXException {
-        String source = "http://josm.openstreetmap.de/josmfile?page=Presets/BicycleJunction&amp;preset";
-        TaggingPresets.addTaggingPresets(TaggingPresetReader.readAll(source, true));
+        String source = "presets/Presets_BicycleJunction-preset.xml";
+        wireMockRule.stubFor(get(urlEqualTo("/" + source))
+                .willReturn(aResponse()
+                    .withStatus(200)
+                    .withHeader("Content-Type", "text/xml")
+                    .withBodyFile(source)));
+        TaggingPresets.addTaggingPresets(TaggingPresetReader.readAll("http://localhost:" + wireMockRule.port() + "/" + source, true));
 
         Comparator<Relation> comparator = DefaultNameFormatter.getInstance().getRelationComparator();
Index: /trunk/test/unit/org/openstreetmap/josm/gui/preferences/imagery/ImageryPreferenceTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/gui/preferences/imagery/ImageryPreferenceTest.java	(revision 12556)
+++ /trunk/test/unit/org/openstreetmap/josm/gui/preferences/imagery/ImageryPreferenceTest.java	(revision 12557)
@@ -4,6 +4,11 @@
 import static org.junit.Assert.assertNotNull;
 
+import java.io.File;
+import java.util.Arrays;
+
 import org.junit.Rule;
 import org.junit.Test;
+import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.TestUtils;
 import org.openstreetmap.josm.gui.preferences.PreferencesTestUtils;
 import org.openstreetmap.josm.testutils.JOSMTestRules;
@@ -21,5 +26,5 @@
     @Rule
     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().platform().commands();
+    public JOSMTestRules test = new JOSMTestRules().platform().mainMenu();
 
     /**
@@ -36,4 +41,6 @@
     @Test
     public void testAddGui() {
+        String fileUrl = new File(TestUtils.getTestDataRoot()+"__files/imagery/maps.xml").toURI().toString();
+        Main.pref.putCollection("imagery.layers.sites", Arrays.asList(fileUrl));
         PreferencesTestUtils.doTestPreferenceSettingAddGui(new ImageryPreference.Factory(), null);
     }
Index: /trunk/test/unit/org/openstreetmap/josm/io/OverpassDownloadReaderTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/io/OverpassDownloadReaderTest.java	(revision 12556)
+++ /trunk/test/unit/org/openstreetmap/josm/io/OverpassDownloadReaderTest.java	(revision 12557)
@@ -2,4 +2,8 @@
 package org.openstreetmap.josm.io;
 
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.get;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
+import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
@@ -7,12 +11,15 @@
 import java.util.regex.Matcher;
 
+import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
+import org.openstreetmap.josm.TestUtils;
 import org.openstreetmap.josm.data.Bounds;
-import org.openstreetmap.josm.gui.preferences.server.OverpassServerPreference;
 import org.openstreetmap.josm.io.OverpassDownloadReader.OverpassOutpoutFormat;
 import org.openstreetmap.josm.testutils.JOSMTestRules;
 import org.openstreetmap.josm.tools.OverpassTurboQueryWizard;
 import org.openstreetmap.josm.tools.Utils;
+
+import com.github.tomakehurst.wiremock.junit.WireMockRule;
 
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
@@ -28,9 +35,25 @@
     @Rule
     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().timeout(15000);
+    public JOSMTestRules test = new JOSMTestRules().preferences();
+
+    /**
+     * HTTP mock.
+     */
+    @Rule
+    public WireMockRule wireMockRule = new WireMockRule(options().dynamicPort().usingFilesUnderDirectory(TestUtils.getTestDataRoot()));
+
+    private static final String NOMINATIM_URL_PATH = "/search?format=xml&q=";
+
+    /**
+     * Setup test.
+     */
+    @Before
+    public void setUp() {
+        NameFinder.NOMINATIM_URL_PROP.put("http://localhost:" + wireMockRule.port() + NOMINATIM_URL_PATH);
+    }
 
     private String getExpandedQuery(String search) {
         final String query = OverpassTurboQueryWizard.getInstance().constructQuery(search);
-        final String request = new OverpassDownloadReader(new Bounds(1, 2, 3, 4), OverpassServerPreference.getOverpassServer(), query)
+        final String request = new OverpassDownloadReader(new Bounds(1, 2, 3, 4), null, query)
                 .getRequestForBbox(1, 2, 3, 4)
                 .substring("interpreter?data=".length());
@@ -55,4 +78,12 @@
     }
 
+    private void stubNominatim(String query) {
+        wireMockRule.stubFor(get(urlEqualTo(NOMINATIM_URL_PATH + query))
+                .willReturn(aResponse()
+                    .withStatus(200)
+                    .withHeader("Content-Type", "text/xml")
+                    .withBodyFile("nominatim/" + query + ".xml")));
+    }
+
     /**
      * Tests evaluating the extended query feature {@code geocodeArea}.
@@ -60,4 +91,5 @@
     @Test
     public void testGeocodeArea() {
+        stubNominatim("London");
         final String query = getExpandedQuery("amenity=drinking_water in London");
         assertEquals("" +
@@ -78,4 +110,5 @@
     @Test
     public void testGeocodeUnknownArea() {
+        stubNominatim("foo-bar-baz-does-not-exist");
         final String query = OverpassDownloadReader.expandExtendedQueries("{{geocodeArea:foo-bar-baz-does-not-exist}}");
         assertEquals("// Failed to evaluate {{geocodeArea:foo-bar-baz-does-not-exist}}\n", query);
Index: /trunk/test/unit/org/openstreetmap/josm/testutils/JOSMTestRules.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/testutils/JOSMTestRules.java	(revision 12556)
+++ /trunk/test/unit/org/openstreetmap/josm/testutils/JOSMTestRules.java	(revision 12557)
@@ -17,4 +17,6 @@
 import org.openstreetmap.josm.data.osm.event.SelectionEventManager;
 import org.openstreetmap.josm.data.projection.Projections;
+import org.openstreetmap.josm.gui.MainApplication;
+import org.openstreetmap.josm.gui.MainMenu;
 import org.openstreetmap.josm.gui.mappaint.MapPaintStyles;
 import org.openstreetmap.josm.gui.util.GuiHelper;
@@ -55,4 +57,6 @@
     private boolean territories;
     private boolean rlTraffic;
+    private boolean main;
+    private boolean mainMenu;
 
     /**
@@ -205,4 +209,25 @@
     public JOSMTestRules rlTraffic() {
         rlTraffic = true;
+        return this;
+    }
+
+    /**
+     * Use the {@link Main#main} application in this test.
+     * @return this instance, for easy chaining
+     * @since xxx
+     */
+    public JOSMTestRules main() {
+        main = true;
+        return this;
+    }
+
+    /**
+     * Use the {@link Main#menu} in this test.
+     * @return this instance, for easy chaining
+     * @since xxx
+     */
+    public JOSMTestRules mainMenu() {
+        main();
+        mainMenu = true;
         return this;
     }
@@ -311,4 +336,14 @@
             // TODO: Implement a more selective version of this once Main is restructured.
             JOSMFixture.createUnitTestFixture().init(true);
+        } else {
+            if (main) {
+                new MainApplication();
+            }
+
+            if (mainMenu) {
+                JOSMFixture.initContentPane();
+                JOSMFixture.initToolbar();
+                Main.main.menu = new MainMenu();
+            }
         }
     }
