@Test
public void getUnversionedDistributionsWithLinksTest() {

    // Setup:
    Set<Distribution> distributions = IntStream.range(1, 6)
            .mapToObj(i -> DISTRIBUTION_IRI + i)
            .map(s -> distributionFactory.createNew(vf.createIRI(s)))
            .collect(Collectors.toSet());
    distributions.forEach(distribution -> distribution.setProperty(vf.createLiteral("Title"), vf.createIRI(DCTERMS.TITLE.stringValue())));
    when(catalogManager.getUnversionedDistributions(any(Resource.class), any(Resource.class))).thenReturn(distributions);
    Response response = target().path("catalogs/" + encode(LOCAL_IRI) + "/records/" + encode(RECORD_IRI) + "/distributions")
            .queryParam("sort", DCTERMS.TITLE.stringValue())
            .queryParam("offset", 1)
            .queryParam("limit", 1).request().get();
    assertEquals(response.getStatus(), 200);
    verify(catalogManager).getUnversionedDistributions(vf.createIRI(LOCAL_IRI), vf.createIRI(RECORD_IRI));
    Set<Link> links = response.getLinks();
    assertEquals(links.size(), 2);
    links.forEach(link -> {
        assertTrue(link.getUri().getRawPath().contains("catalogs/" + encode(LOCAL_IRI) + "/records/"
                + encode(RECORD_IRI) + "/distributions"));
        assertTrue(link.getRel().equals("prev") || link.getRel().equals("next"));
    });
}