コード例 #1
0
    @Test
    public void shouldAddLinksAndElements() {
      final FeedPagingProcessor target = feedPagingProcessor();
      final AdapterResponse<Feed> feedResponse = adapterResponse(TOTAL_FEED_ENTRIES);
      final RequestContext rc = requestContext();

      target.process(rc, feedResponse);

      Feed feed = feedResponse.getBody().getAsFeed();
      assertThat("Should set updated element", feed.getUpdated(), notNullValue());
    }
コード例 #2
0
    @Test
    public void shouldNotAddMarkers() {
      final FeedPagingProcessor target = feedPagingProcessor();
      final AdapterResponse<Feed> feedResponse = adapterResponse(TOTAL_FEED_ENTRIES);
      final RequestContext rc = requestContext();

      target.process(rc, feedResponse);

      Feed feed = feedResponse.getBody().getAsFeed();
      assertThat("Should not set current link", feed.getLink(REL_CURRENT), nullValue());
      assertThat("Should not set next link", feed.getLink(REL_NEXT), nullValue());
    }
コード例 #3
0
    @Test
    public void shouldNotOverrideWhenNextIsSet() {
      final FeedPagingProcessor target = feedPagingProcessor();
      final AdapterResponse<Feed> feedResponse = adapterResponse(1, true);
      final RequestContext rc = requestContext();

      target.process(rc, feedResponse);

      Feed feed = feedResponse.getBody().getAsFeed();
      assertThat(
          "Should not override next link",
          feed.getLink(REL_NEXT).getHref().toString(),
          equalTo(REL_NEXT));
    }