diff --git a/src/org/openstreetmap/josm/plugins/mapillary/utils/MapillaryURL.java b/src/org/openstreetmap/josm/plugins/mapillary/utils/MapillaryURL.java index 311c462d1..41cf9d40d 100644 --- a/src/org/openstreetmap/josm/plugins/mapillary/utils/MapillaryURL.java +++ b/src/org/openstreetmap/josm/plugins/mapillary/utils/MapillaryURL.java @@ -18,10 +18,6 @@ public final class MapillaryURL { private static final String BASE_API_V2_URL = "https://a.mapillary.com/v2/"; private static final String CLIENT_ID = "T1Fzd20xZjdtR0s1VDk5OFNIOXpYdzoxNDYyOGRkYzUyYTFiMzgz"; - public enum IMAGE_SELECTOR { - BLURRED_ONLY, COMMENTED_ONLY, OBJ_REC_ONLY // null is used when all images should be selected - } - public static final class APIv3 { private static final String BASE_URL = "https://a.mapillary.com/v3/"; diff --git a/test/unit/org/openstreetmap/josm/plugins/mapillary/utils/MapillaryURLTest.java b/test/unit/org/openstreetmap/josm/plugins/mapillary/utils/MapillaryURLTest.java index 4c1ffe076..e06a3509a 100644 --- a/test/unit/org/openstreetmap/josm/plugins/mapillary/utils/MapillaryURLTest.java +++ b/test/unit/org/openstreetmap/josm/plugins/mapillary/utils/MapillaryURLTest.java @@ -14,15 +14,25 @@ import java.nio.charset.StandardCharsets; import org.junit.Test; + import org.openstreetmap.josm.data.Bounds; import org.openstreetmap.josm.data.coor.LatLon; -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"; public static class APIv3 { + + @Test + public void testSearchDetections() { + assertUrlEquals(MapillaryURL.APIv3.searchDetections(null), "https://a.mapillary.com/v3/detections", CLIENT_ID_QUERY_PART); + } + + @Test + public void testSearchImages() { + assertUrlEquals(MapillaryURL.APIv3.searchImages(null), "https://a.mapillary.com/v3/images", CLIENT_ID_QUERY_PART); + } + @Test public void testSearchSequences() throws UnsupportedEncodingException { assertUrlEquals( @@ -88,6 +98,14 @@ public void testParseNextFromHeaderValueMalformed() { } } + public class Cloudfront { + @Test + public void testThumbnail() { + assertUrlEquals(MapillaryURL.Cloudfront.thumbnail("arbitrary_key", true), "https://d1cuyjsrcm0gby.cloudfront.net/arbitrary_key/thumb-2048.jpg"); + assertUrlEquals(MapillaryURL.Cloudfront.thumbnail("arbitrary_key2", true), "https://d1cuyjsrcm0gby.cloudfront.net/arbitrary_key2/thumb-320.jpg"); + } + } + @Test public void testBrowseImageURL() throws MalformedURLException { assertEquals( @@ -151,12 +169,14 @@ public void testString2MalformedURL() Method method = MapillaryURL.class.getDeclaredMethod("string2URL", String[].class); method.setAccessible(true); assertNull(method.invoke(null, new Object[]{new String[]{"malformed URL"}})); // this simply invokes string2URL("malformed URL") + assertNull(method.invoke(null, new Object[]{null})); // invokes string2URL(null) } @Test public void testUtilityClass() { TestUtil.testUtilityClass(MapillaryURL.class); TestUtil.testUtilityClass(MapillaryURL.APIv3.class); + TestUtil.testUtilityClass(MapillaryURL.Cloudfront.class); TestUtil.testUtilityClass(MapillaryURL.MainWebsite.class); }