Index: applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/utils/MapillaryURLTest.java
===================================================================
--- applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/utils/MapillaryURLTest.java	(revision 32067)
+++ applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/utils/MapillaryURLTest.java	(revision 32069)
@@ -4,5 +4,4 @@
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
 
 import java.lang.reflect.InvocationTargetException;
@@ -13,6 +12,10 @@
 import org.junit.Test;
 import org.openstreetmap.josm.data.Bounds;
+import org.openstreetmap.josm.plugins.mapillary.utils.MapillaryURL.IMAGE_SELECTOR;
 
 public class MapillaryURLTest {
+  private static final String CLIENT_ID_QUERY_PART = "client_id=T1Fzd20xZjdtR0s1VDk5OFNIOXpYdzoxNDYyOGRkYzUyYTFiMzgz";
+  private static final String LIMIT_20_QUERY_PART = "limit=20";
+
   @Test
   public void testBrowseEditURL() throws MalformedURLException {
@@ -21,16 +24,24 @@
         MapillaryURL.browseEditURL("1234567890123456789012")
     );
-    try {
-      MapillaryURL.browseEditURL(null);
-      fail();
-    } catch (IllegalArgumentException e) {}
-    try {
-      MapillaryURL.browseEditURL("123456789012345678901");
-      fail();
-    } catch (IllegalArgumentException e) {}
-    try {
-      MapillaryURL.browseEditURL("123456789012345678901+");
-      fail();
-    } catch (IllegalArgumentException e) {}
+  }
+
+  @Test(expected=IllegalArgumentException.class)
+  public void testIllegalBrowseEditURL() {
+    MapillaryURL.browseEditURL(null);
+  }
+
+  @Test(expected=IllegalArgumentException.class)
+  public void testIllegalBrowseEditURL2() {
+    MapillaryURL.browseEditURL("123456789012345678901");
+  }
+
+  @Test(expected=IllegalArgumentException.class)
+  public void testIllegalBrowseEditURL3() {
+    MapillaryURL.browseEditURL("12345678901234567890123");
+  }
+
+  @Test(expected=IllegalArgumentException.class)
+  public void testIllegalBrowseEditURL4() {
+    MapillaryURL.browseEditURL("123456789012345678901+");
   }
 
@@ -41,21 +52,29 @@
         MapillaryURL.browseImageURL("1234567890123456789012")
     );
-    try {
-      MapillaryURL.browseImageURL(null);
-      fail();
-    } catch (IllegalArgumentException e) {}
-    try {
-      MapillaryURL.browseImageURL("123456789012345678901");
-      fail();
-    } catch (IllegalArgumentException e) {}
-    try {
-      MapillaryURL.browseImageURL("123456789012345678901+");
-      fail();
-    } catch (IllegalArgumentException e) {}
+  }
+
+  @Test(expected=IllegalArgumentException.class)
+  public void testIllegalBrowseImageURL() {
+    MapillaryURL.browseImageURL(null);
+  }
+
+  @Test(expected=IllegalArgumentException.class)
+  public void testIllegalBrowseImageURL2() {
+    MapillaryURL.browseImageURL("123456789012345678901");
+  }
+
+  @Test(expected=IllegalArgumentException.class)
+  public void testIllegalBrowseImageURL3() {
+    MapillaryURL.browseImageURL("12345678901234567890123");
+  }
+
+  @Test(expected=IllegalArgumentException.class)
+  public void testIllegalBrowseImageURL4() {
+    MapillaryURL.browseImageURL("123456789012345678901+");
   }
 
   @Test
   public void testBrowseUploadImageURL() throws MalformedURLException {
-    assertEquals(new URL("https://www.mapillary.com/map/upload/im/"), MapillaryURL.browseUploadImageURL());
+    assertEquals(new URL("https://www.mapillary.com/map/upload/im"), MapillaryURL.browseUploadImageURL());
   }
 
@@ -65,5 +84,5 @@
         MapillaryURL.connectURL("http://redirect-host/ä"),
         "https://www.mapillary.com/connect",
-        "client_id=T1Fzd20xZjdtR0s1VDk5OFNIOXpYdzoxNDYyOGRkYzUyYTFiMzgz",
+        CLIENT_ID_QUERY_PART,
         "scope=user%3Aread+public%3Aupload+public%3Awrite",
         "response_type=token",
@@ -74,5 +93,5 @@
         MapillaryURL.connectURL(null),
         "https://www.mapillary.com/connect",
-        "client_id=T1Fzd20xZjdtR0s1VDk5OFNIOXpYdzoxNDYyOGRkYzUyYTFiMzgz",
+        CLIENT_ID_QUERY_PART,
         "scope=user%3Aread+public%3Aupload+public%3Awrite",
         "response_type=token"
@@ -82,5 +101,5 @@
         MapillaryURL.connectURL(""),
         "https://www.mapillary.com/connect",
-        "client_id=T1Fzd20xZjdtR0s1VDk5OFNIOXpYdzoxNDYyOGRkYzUyYTFiMzgz",
+        CLIENT_ID_QUERY_PART,
         "scope=user%3Aread+public%3Aupload+public%3Awrite",
         "response_type=token"
@@ -91,19 +110,19 @@
   public void testSearchImageURL() {
     assertUrlEquals(
-        MapillaryURL.searchImageURL(new Bounds(1.1, 2.22, 3.333, 4.4444), 42),
-        "https://a.mapillary.com/v2/search/im/",
-        "client_id=T1Fzd20xZjdtR0s1VDk5OFNIOXpYdzoxNDYyOGRkYzUyYTFiMzgz",
+        MapillaryURL.searchImageInfoURL(new Bounds(1.1, 2.22, 3.333, 4.4444), 42, null),
+        "https://a.mapillary.com/v2/search/im",
+        CLIENT_ID_QUERY_PART,
         "min_lon=2.220000",
         "max_lon=4.444400",
         "min_lat=1.100000",
         "max_lat=3.333000",
-        "limit=20",
+        LIMIT_20_QUERY_PART,
         "page=42"
     );
     assertUrlEquals(
-        MapillaryURL.searchImageURL(null, -73),
-        "https://a.mapillary.com/v2/search/im/",
-        "client_id=T1Fzd20xZjdtR0s1VDk5OFNIOXpYdzoxNDYyOGRkYzUyYTFiMzgz",
-        "limit=20",
+        MapillaryURL.searchImageInfoURL(null, -73, null),
+        "https://a.mapillary.com/v2/search/im",
+        CLIENT_ID_QUERY_PART,
+        LIMIT_20_QUERY_PART,
         "page=-73"
     );
@@ -114,6 +133,6 @@
     assertUrlEquals(
         MapillaryURL.searchSequenceURL(new Bounds(-55.55555, -66.666666, 77.7777777, 88.88888888, false), 42),
-        "https://a.mapillary.com/v2/search/s/",
-        "client_id=T1Fzd20xZjdtR0s1VDk5OFNIOXpYdzoxNDYyOGRkYzUyYTFiMzgz",
+        "https://a.mapillary.com/v2/search/s",
+        CLIENT_ID_QUERY_PART,
         "min_lon=-66.666666",
         "max_lon=88.888889",
@@ -125,6 +144,6 @@
     assertUrlEquals(
         MapillaryURL.searchSequenceURL(null, -73),
-        "https://a.mapillary.com/v2/search/s/",
-        "client_id=T1Fzd20xZjdtR0s1VDk5OFNIOXpYdzoxNDYyOGRkYzUyYTFiMzgz",
+        "https://a.mapillary.com/v2/search/s",
+        CLIENT_ID_QUERY_PART,
         "limit=10",
         "page=-73"
@@ -135,19 +154,19 @@
   public void testSearchTrafficSignURL() {
     assertUrlEquals(
-        MapillaryURL.searchTrafficSignURL(new Bounds(1.1, 2.22, 3.333, 4.4444), -42),
-        "https://a.mapillary.com/v2/search/im/or/",
-        "client_id=T1Fzd20xZjdtR0s1VDk5OFNIOXpYdzoxNDYyOGRkYzUyYTFiMzgz",
+        MapillaryURL.searchImageInfoURL(new Bounds(1.1, 2.22, 3.333, 4.4444), -42, IMAGE_SELECTOR.OBJ_REC_ONLY),
+        "https://a.mapillary.com/v2/search/im/or",
+        CLIENT_ID_QUERY_PART,
         "min_lon=2.220000",
         "max_lon=4.444400",
         "min_lat=1.100000",
         "max_lat=3.333000",
-        "limit=20",
+        LIMIT_20_QUERY_PART,
         "page=-42"
     );
     assertUrlEquals(
-        MapillaryURL.searchTrafficSignURL(null, 73),
-        "https://a.mapillary.com/v2/search/im/or/",
-        "client_id=T1Fzd20xZjdtR0s1VDk5OFNIOXpYdzoxNDYyOGRkYzUyYTFiMzgz",
-        "limit=20",
+        MapillaryURL.searchImageInfoURL(null, 73, IMAGE_SELECTOR.OBJ_REC_ONLY),
+        "https://a.mapillary.com/v2/search/im/or",
+        CLIENT_ID_QUERY_PART,
+        LIMIT_20_QUERY_PART,
         "page=73"
     );
@@ -157,5 +176,5 @@
   public void testUploadSecretsURL() throws MalformedURLException {
     assertEquals(
-        new URL("https://a.mapillary.com/v2/me/uploads/secrets/?client_id=T1Fzd20xZjdtR0s1VDk5OFNIOXpYdzoxNDYyOGRkYzUyYTFiMzgz"),
+        new URL("https://a.mapillary.com/v2/me/uploads/secrets?"+CLIENT_ID_QUERY_PART),
         MapillaryURL.uploadSecretsURL()
     );
@@ -165,5 +184,5 @@
   public void testUserURL() throws MalformedURLException {
     assertEquals(
-        new URL("https://a.mapillary.com/v2/me/?client_id=T1Fzd20xZjdtR0s1VDk5OFNIOXpYdzoxNDYyOGRkYzUyYTFiMzgz"),
+        new URL("https://a.mapillary.com/v2/me?"+CLIENT_ID_QUERY_PART),
         MapillaryURL.userURL()
     );
@@ -172,8 +191,8 @@
   @Test
   public void testString2MalformedURL()
-      throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
-    Method method = MapillaryURL.class.getDeclaredMethod("string2URL", String.class);
+      throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException {
+    Method method = MapillaryURL.class.getDeclaredMethod("string2URL", String[].class);
     method.setAccessible(true);
-    assertNull(method.invoke(null, "bla"));
+    assertNull(method.invoke(null, new Object[]{new String[]{"malformed URL"}})); // this simply invokes string2URL("malformed URL")
   }
 
