@Test public void testGetPhotos() throws Exception { stubFor(get(urlPathEqualTo("/v2/photomap.locations")) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "application/json") .withBodyFile("photos.json"))); Photos photos = apiClient.getPhotos(0.1, 52.2, 0.2, 52.3); verify(getRequestedFor(urlPathEqualTo("/v2/photomap.locations")) .withQueryParam("bbox", equalTo("0.1,52.2,0.2,52.3")) .withQueryParam("fields", equalTo("id,caption,datetime,categoryId,metacategoryId,hasVideo,videoFormats,thumbnailUrl,shortlink")) .withQueryParam("thumbnailsize", equalTo("640")) .withQueryParam("limit", equalTo("45")) .withQueryParam("key", equalTo("myApiKey"))); Iterator<Photo> iterator = photos.iterator(); iterator.next(); iterator.next(); iterator.next(); Photo photo4 = iterator.next(); assertThat(iterator.hasNext()).isFalse(); assertThat(photo4.id()).isEqualTo(82169); assertThat(photo4.caption()).isEqualTo("Link from Clerk Maxwell Road to the West Cambridge site"); assertThat(photo4.datetime()).isEqualTo(1466693269L); assertThat(photo4.category()).isEqualTo("cycleways"); assertThat(photo4.metacategory()).isEqualTo("other"); assertThat(photo4.thumbnailUrl()).isEqualTo("https: assertThat(photo4.url()).isEqualTo("https: assertThat(photo4.position()).isEqualTo(new GeoPoint(52.209908, 0.094543)); assertThat(photo4.isPlaceholder()).isFalse(); assertThat(photo4.hasVideos()).isTrue(); List<Video> videos = (List<Video>)photo4.videos(); assertThat(videos.size()).isEqualTo(2); Video video = videos.get(1); assertThat(video.url()).isEqualTo("https: assertThat(video.format()).isEqualTo("flv"); }
public Photos getPhotos(final double lonW, final double latS, final double lonE, final double latN) throws IOException { String bbox = toBboxString(lonW, latS, lonE, latN); Response<FeatureCollection> response = v2Api.getPhotos(bbox).execute(); return PhotosFactory.toPhotos(response.body()); }
RetrofitApiClient { public Photos getPhotos(final double lonW, final double latS, final double lonE, final double latN) throws IOException { String bbox = toBboxString(lonW, latS, lonE, latN); Response<FeatureCollection> response = v2Api.getPhotos(bbox).execute(); return PhotosFactory.toPhotos(response.body()); } }
RetrofitApiClient { public Photos getPhotos(final double lonW, final double latS, final double lonE, final double latN) throws IOException { String bbox = toBboxString(lonW, latS, lonE, latN); Response<FeatureCollection> response = v2Api.getPhotos(bbox).execute(); return PhotosFactory.toPhotos(response.body()); } @SuppressWarnings("deprecation")  RetrofitApiClient(Builder builder); }
RetrofitApiClient { public Photos getPhotos(final double lonW, final double latS, final double lonE, final double latN) throws IOException { String bbox = toBboxString(lonW, latS, lonE, latN); Response<FeatureCollection> response = v2Api.getPhotos(bbox).execute(); return PhotosFactory.toPhotos(response.body()); } @SuppressWarnings("deprecation")  RetrofitApiClient(Builder builder); String getJourneyJson(final String plan,
                               final String itineraryPoints,
                               final String leaving,
                               final String arriving,
                               final int speed); String retrievePreviousJourneyJson(final String plan,
                                            final long itineraryId); Blog getBlogEntries(); POICategories getPOICategories(); List<POI> getPOIs(final String type,
                           final double lonW,
                           final double latS,
                           final double lonE,
                           final double latN); List<POI> getPOIs(final String type,
                           final double lon,
                           final double lat,
                           final int radius); GeoPlaces geoCoder(final String search,
                            final double lonW,
                            final double latS,
                            final double lonE,
                            final double latN); PhotomapCategories getPhotomapCategories(); Photos getPhotos(final double lonW,
                          final double latS,
                          final double lonE,
                          final double latN); Photos getPhoto(final long photoId); UserJourneys getUserJourneys(final String username); Result register(final String username,
                         final String password,
                         final String name,
                         final String email); Signin.Result authenticate(final String identifier,
                                    final String password); Result sendFeedback(final int itinerary,
                             final String comments,
                             final String name,
                             final String email); Upload.Result uploadPhoto(final String username,
                                   final String password,
                                   final double lon,
                                   final double lat,
                                   final long dateTime,
                                   final String category,
                                   final String metaCat,
                                   final String caption,
                                   final String filename); }
RetrofitApiClient { public Photos getPhotos(final double lonW, final double latS, final double lonE, final double latN) throws IOException { String bbox = toBboxString(lonW, latS, lonE, latN); Response<FeatureCollection> response = v2Api.getPhotos(bbox).execute(); return PhotosFactory.toPhotos(response.body()); } @SuppressWarnings("deprecation")  RetrofitApiClient(Builder builder); String getJourneyJson(final String plan,
                               final String itineraryPoints,
                               final String leaving,
                               final String arriving,
                               final int speed); String retrievePreviousJourneyJson(final String plan,
                                            final long itineraryId); Blog getBlogEntries(); POICategories getPOICategories(); List<POI> getPOIs(final String type,
                           final double lonW,
                           final double latS,
                           final double lonE,
                           final double latN); List<POI> getPOIs(final String type,
                           final double lon,
                           final double lat,
                           final int radius); GeoPlaces geoCoder(final String search,
                            final double lonW,
                            final double latS,
                            final double lonE,
                            final double latN); PhotomapCategories getPhotomapCategories(); Photos getPhotos(final double lonW,
                          final double latS,
                          final double lonE,
                          final double latN); Photos getPhoto(final long photoId); UserJourneys getUserJourneys(final String username); Result register(final String username,
                         final String password,
                         final String name,
                         final String email); Signin.Result authenticate(final String identifier,
                                    final String password); Result sendFeedback(final int itinerary,
                             final String comments,
                             final String name,
                             final String email); Upload.Result uploadPhoto(final String username,
                                   final String password,
                                   final double lon,
                                   final double lat,
                                   final long dateTime,
                                   final String category,
                                   final String metaCat,
                                   final String caption,
                                   final String filename);  }