@Test @Ignore public void testUsingProvidedPath() throws IOException { final File dir = createTempDirectory(); System.setProperty("org.kie.nio.git.dir", dir.toString()); JGitFileSystemProvider.loadConfig(); final JGitFileSystemProvider provider = new JGitFileSystemProvider(); final URI newRepo = URI.create("git://repo-name"); provider.newFileSystem(newRepo, EMPTY_ENV); final String[] names = dir.list(); assertThat(names).isNotEmpty().contains(".niogit"); final String[] repos = new File(dir, ".niogit").list(); assertThat(repos).isNotEmpty().contains("repo-name.git"); System.setProperty("org.kie.nio.git.dir", ""); }
/** Tests the {@link io.github.tjg1.library.norilib.SearchResult#getImages()} method. */ public void testGetImages() throws Throwable { final SearchResult searchResult = getMockSearchResult(); assertThat(searchResult.getImages()).isNotEmpty(); }
assertThat(searchResults[0].getImages()).isNotEmpty();
public void testSearchUsingTagsAndOffset() throws Throwable { // TODO: Ideally this should be mocked, so testing doesn't rely on external APIs. // Create a new client connected to the Danbooru API. final SearchClient client = createSearchClient(); // Retrieve search results. final SearchResult page1 = client.search(getDefaultTag(), 0); final SearchResult page2 = client.search(getDefaultTag(), 1); // Make sure that the results differ. assertThat(page1.getImages()).isNotEmpty(); assertThat(page2.getImages()).isNotEmpty(); assertThat(page2.getCurrentOffset()).isEqualTo(1); assertThat(page1.getImages()[0].id).isNotEqualTo(page2.getImages()[0].id); assertThat(page1.getImages()[0].searchPage).isEqualTo(page1.getCurrentOffset()); assertThat(page1.getImages()[0].searchPagePosition).isEqualTo(0); assertThat(page1.getImages()[1].searchPagePosition).isEqualTo(1); assertThat(page2.getImages()[0].searchPage).isEqualTo(page2.getCurrentOffset()); assertThat(page2.getImages()[0].searchPagePosition).isEqualTo(0); assertThat(page2.getImages()[1].searchPagePosition).isEqualTo(1); }
public void testSearchUsingTags() throws Throwable { // TODO: Ideally this should be mocked, so testing doesn't rely on external APIs. // Create a new client connected to the Danbooru API. final SearchClient client = createSearchClient(); // Retrieve a search result. final SearchResult result = client.search(getDefaultTag()); // Make sure we got results back. assertThat(result.getImages()).isNotEmpty(); // Verify metadata for each returned image. for (Image image : result.getImages()) { ImageTests.verifyImage(image); } // Check rests of the values. assertThat(result.getCurrentOffset()).isEqualTo(0); assertThat(result.getQuery()).hasSize(1); assertThat(result.getQuery()[0].getName()).isEqualTo(getDefaultTag()); assertThat(result.hasNextPage()).isTrue(); }