  @Test
  public void testGetBlogEntries() throws Exception {

    // given
    stubFor(get(urlPathEqualTo("/news/feed/"))
            .willReturn(aResponse()
                    .withStatus(200)
                    .withHeader("Content-Type", "application/rss+xml; charset=UTF-8")
                    .withBodyFile("blogfeed.xml")));

    // when
    Blog blog = apiClient.getBlogEntries();

    // call the endpoint 5 more times
    for (int ii = 0; ii < 5; ii++) {
      apiClient.getBlogEntries();
    }

    // then
    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");

    // caching should mean the REST request is only made once
    List<LoggedRequest> requests = findAll(getRequestedFor(urlPathEqualTo("/news/feed/"))
            .withQueryParam("key", equalTo("myApiKey")));
    assertThat(requests).hasSize(1);
  }