@Before
  public void setUp() throws Exception {
    manager = new CollectionListManagerImpl();

    accessControlUtils = mock(AccessControlUtils.class);
    when(accessControlUtils.hasAccess(any(PID.class), anyCollection(), anyString()))
        .thenReturn(true);
    manager.setAccessControlUtils(accessControlUtils);

    tripleStoreQueryService = mock(TripleStoreQueryService.class);

    manager.setTripleStoreQueryService(tripleStoreQueryService);

    config = new SwordConfigurationImpl();
    config.setBasePath("https://localhost/services");
    config.setSwordPath("https://localhost/services/sword");
    config.setSwordVersion("1.3");
  }
  @Test
  public void listCollections() throws Exception {
    String pidString = "uuid:23425234532434";
    String url = "https://localhost/services/collection/" + pidString;
    IRI iri = new IRI(url);

    Map<?, ?> response = this.generateImmediateChildrenResponse(10);

    when(tripleStoreQueryService.sendSPARQL(anyString())).thenReturn(response);

    Feed feed = manager.listCollectionContents(iri, new AuthCredentials("", "", ""), config);
    assertEquals(feed.getEntries().size(), 10);
    assertEquals(feed.getLinks().size(), 1);
    assertTrue(pidString.equals(feed.getId().toString()));
  }
  @Test
  public void listCollectionsSecondPage() throws Exception {
    String pidString = "uuid:23425234532434";
    String url = "https://localhost/services/collection/" + pidString + "/1";
    IRI iri = new IRI(url);

    Map<?, ?> response = this.generateImmediateChildrenResponse(10);

    when(tripleStoreQueryService.sendSPARQL(endsWith(" 0"))).thenReturn(null);
    when(tripleStoreQueryService.sendSPARQL(endsWith(" 10"))).thenReturn(response);

    Feed feed = manager.listCollectionContents(iri, new AuthCredentials("", "", ""), config);
    assertEquals(feed.getEntries().size(), 10);
    assertEquals(feed.getLinks().size(), 1);
    String nextLink = feed.getLink("next").getHref().toString();
    nextLink = nextLink.substring(nextLink.lastIndexOf("/") + 1);
    assertTrue("2".equals(nextLink));
    assertTrue(pidString.equals(feed.getId().toString()));
  }