@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()); }
@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()); }
@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)); }