@Test public void testGetBlogEntries() throws Exception { stubFor(get(urlPathEqualTo("/news/feed/")) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "application/rss+xml; charset=UTF-8") .withBodyFile("blogfeed.xml"))); Blog blog = apiClient.getBlogEntries(); for (int ii = 0; ii < 5; ii++) { apiClient.getBlogEntries(); } verify(getRequestedFor(urlPathEqualTo("/news/feed/")) .withQueryParam("key", equalTo("myApiKey"))); assertThat(blog).isNotNull(); assertThat(blog.mostRecentTitle()).isEqualTo("Cyclescape website redesign coming soon"); assertThat(blog.mostRecent()).isEqualTo("Thu, 02 Jan 2020 20:25:56 +0000"); List<LoggedRequest> requests = findAll(getRequestedFor(urlPathEqualTo("/news/feed/")) .withQueryParam("key", equalTo("myApiKey"))); assertThat(requests).hasSize(1); }
public Blog getBlogEntries() throws IOException { Response<BlogFeedDto> response = blogApi.getBlogEntries().execute(); return response.body().toBlog(); }
RetrofitApiClient { public Blog getBlogEntries() throws IOException { Response<BlogFeedDto> response = blogApi.getBlogEntries().execute(); return response.body().toBlog(); } }
RetrofitApiClient { public Blog getBlogEntries() throws IOException { Response<BlogFeedDto> response = blogApi.getBlogEntries().execute(); return response.body().toBlog(); } @SuppressWarnings("deprecation")  RetrofitApiClient(Builder builder); }
RetrofitApiClient { public Blog getBlogEntries() throws IOException { Response<BlogFeedDto> response = blogApi.getBlogEntries().execute(); return response.body().toBlog(); } @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 Blog getBlogEntries() throws IOException { Response<BlogFeedDto> response = blogApi.getBlogEntries().execute(); return response.body().toBlog(); } @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);  }