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